diff --git a/src/bin/regiondump.rs b/src/bin/regiondump.rs index 5663a80..f3b7210 100644 --- a/src/bin/regiondump.rs +++ b/src/bin/regiondump.rs @@ -15,6 +15,7 @@ fn main() -> Result<()> { minedmap::io::region::from_file(args.file.as_path())?.foreach_chunk( |coords, value: fastnbt::Value| { println!("Chunk {:?}: {:#x?}", coords, value); + Ok(()) }, ) } diff --git a/src/io/region.rs b/src/io/region.rs index 93ff42b..e5c2528 100644 --- a/src/io/region.rs +++ b/src/io/region.rs @@ -73,7 +73,7 @@ impl Region { where R: Read + Seek, T: DeserializeOwned, - F: FnMut(ChunkCoords, T), + F: FnMut(ChunkCoords, T) -> Result<()>, { let Region { mut reader } = self; @@ -119,7 +119,7 @@ impl Region { let chunk = decode_chunk(&buffer) .with_context(|| format!("Failed to decode data for chunk {:?}", coords))?; - f(coords, chunk); + f(coords, chunk)?; } Ok(()) diff --git a/src/main.rs b/src/main.rs index c10cd4a..32aca9a 100644 --- a/src/main.rs +++ b/src/main.rs @@ -41,14 +41,15 @@ impl RegionProcessor { Ok(chunk) => chunk, Err(err) => { eprintln!("Chunk {:?}: {}", coords, err); - return; + return Ok(()); } }; match world::layer::top_layer(&chunk, &self.block_types) { Ok(_) => {} Err(err) => println!("{:?}", err), - } + }; + Ok(()) }) }