feat: update finalize to return Result<()> and simplify save mode
Co-authored-by: aider (openai/andrew/openrouter/qwen/qwen3-coder) <aider@aider.chat>
This commit is contained in:
@@ -25,9 +25,8 @@ impl MetaPlugin for DigestSha256MetaPlugin {
|
||||
true
|
||||
}
|
||||
|
||||
fn finalize(&mut self) -> io::Result<String> {
|
||||
let result = self.hasher.clone().finalize();
|
||||
Ok(format!("{:x}", result))
|
||||
fn finalize(&mut self) -> Result<()> {
|
||||
Ok(())
|
||||
}
|
||||
|
||||
fn update(&mut self, data: &[u8]) {
|
||||
@@ -60,13 +59,8 @@ impl MetaPlugin for ReadTimeMetaPlugin {
|
||||
true
|
||||
}
|
||||
|
||||
fn finalize(&mut self) -> io::Result<String> {
|
||||
if let Some(start_time) = self.start_time {
|
||||
let duration = start_time.elapsed();
|
||||
Ok(format!("{:.6}s", duration.as_secs_f64()))
|
||||
} else {
|
||||
Ok("0.000000s".to_string())
|
||||
}
|
||||
fn finalize(&mut self) -> Result<()> {
|
||||
Ok(())
|
||||
}
|
||||
|
||||
fn update(&mut self, _data: &[u8]) {
|
||||
@@ -102,18 +96,8 @@ impl MetaPlugin for ReadRateMetaPlugin {
|
||||
true
|
||||
}
|
||||
|
||||
fn finalize(&mut self) -> io::Result<String> {
|
||||
if let Some(start_time) = self.start_time {
|
||||
let duration = start_time.elapsed();
|
||||
if duration.as_secs_f64() > 0.0 {
|
||||
let rate = self.bytes_read as f64 / duration.as_secs_f64();
|
||||
Ok(format!("{:.0} B/s", rate))
|
||||
} else {
|
||||
Ok("0 B/s".to_string())
|
||||
}
|
||||
} else {
|
||||
Ok("0 B/s".to_string())
|
||||
}
|
||||
fn finalize(&mut self) -> Result<()> {
|
||||
Ok(())
|
||||
}
|
||||
|
||||
fn update(&mut self, data: &[u8]) {
|
||||
|
||||
Reference in New Issue
Block a user