summaryrefslogtreecommitdiffstats
path: root/vendor/gix-odb/src/sink.rs
diff options
context:
space:
mode:
Diffstat (limited to 'vendor/gix-odb/src/sink.rs')
-rw-r--r--vendor/gix-odb/src/sink.rs14
1 files changed, 6 insertions, 8 deletions
diff --git a/vendor/gix-odb/src/sink.rs b/vendor/gix-odb/src/sink.rs
index 44a406151..f6334a51c 100644
--- a/vendor/gix-odb/src/sink.rs
+++ b/vendor/gix-odb/src/sink.rs
@@ -21,14 +21,12 @@ impl Sink {
}
impl crate::traits::Write for Sink {
- type Error = io::Error;
-
fn write_stream(
&self,
kind: gix_object::Kind,
size: u64,
- mut from: impl io::Read,
- ) -> Result<gix_hash::ObjectId, Self::Error> {
+ from: &mut dyn io::Read,
+ ) -> Result<gix_hash::ObjectId, crate::write::Error> {
let mut size = size.try_into().expect("object size to fit into usize");
let mut buf = [0u8; 8096];
let header = gix_object::encode::loose_header(kind, size);
@@ -42,18 +40,18 @@ impl crate::traits::Write for Sink {
let mut hasher = gix_features::hash::hasher(self.object_hash);
hasher.update(&header);
- possibly_compress(&header)?;
+ possibly_compress(&header).map_err(Box::new)?;
while size != 0 {
let bytes = size.min(buf.len());
- from.read_exact(&mut buf[..bytes])?;
+ from.read_exact(&mut buf[..bytes]).map_err(Box::new)?;
hasher.update(&buf[..bytes]);
- possibly_compress(&buf[..bytes])?;
+ possibly_compress(&buf[..bytes]).map_err(Box::new)?;
size -= bytes;
}
if let Some(compressor) = self.compressor.as_ref() {
let mut c = compressor.borrow_mut();
- c.flush()?;
+ c.flush().map_err(Box::new)?;
c.reset();
}