resetprop: replace nanopb with quick-protobuf for persist

This commit is contained in:
LoveSy
2023-06-23 20:37:06 +08:00
committed by John Wu
parent 7826d7527f
commit 8d81bd0e33
17 changed files with 330 additions and 305 deletions

View File

@@ -345,6 +345,27 @@ impl Directory {
})?;
Ok(())
}
pub fn for_all_file<F: FnMut(&DirEntry) -> io::Result<WalkResult>>(
&mut self,
mut f: F,
) -> io::Result<WalkResult> {
use WalkResult::*;
loop {
match self.read()? {
None => return Ok(Continue),
Some(ref e) => {
if e.is_dir() {
return Ok(Continue);
}
match f(e)? {
Abort | Skip => return Ok(Continue),
Continue => {}
}
}
}
}
}
}
impl Directory {