[thin_check (rust)] Add error handling to io_engine interface

This commit is contained in:
Joe Thornber
2020-09-02 12:57:47 +01:00
parent b82307d8a5
commit 44142f657a
6 changed files with 295 additions and 185 deletions

View File

@@ -93,8 +93,7 @@ fn unpack(data: &[u8]) -> IResult<&[u8], Superblock> {
}
pub fn read_superblock(engine: &dyn IoEngine, loc: u64) -> Result<Superblock> {
let mut b = Block::new(loc);
engine.read(&mut b)?;
let b = engine.read(loc)?;
if let Ok((_, sb)) = unpack(&b.get_data()) {
Ok(sb)