diff --git a/proxmox-compression/src/zstd.rs b/proxmox-compression/src/zstd.rs index 91370a69..e463ff2d 100644 --- a/proxmox-compression/src/zstd.rs +++ b/proxmox-compression/src/zstd.rs @@ -32,10 +32,11 @@ pub struct ZstdEncoder<'a, T> { state: EncoderState, } -impl<'a, T, O> ZstdEncoder<'a, T> +impl<'a, T, O, E> ZstdEncoder<'a, T> where - T: Stream> + Unpin, + T: Stream> + Unpin, O: Into, + E: Into, { /// Returns a new [ZstdEncoder] with default level 3 pub fn new(inner: T) -> Result { @@ -79,10 +80,11 @@ impl<'a, T> ZstdEncoder<'a, T> { } } -impl<'a, T, O> Stream for ZstdEncoder<'a, T> +impl<'a, T, O, E> Stream for ZstdEncoder<'a, T> where - T: Stream> + Unpin, + T: Stream> + Unpin, O: Into, + E: Into, { type Item = Result; @@ -93,7 +95,10 @@ where match this.state { EncoderState::Reading => { if let Some(res) = ready!(Pin::new(&mut this.inner).poll_next(cx)) { - let buf = res?; + let buf = match res { + Ok(buf) => buf, + Err(err) => return Poll::Ready(Some(Err(err.into()))), + }; this.input_buffer = buf.into(); this.state = EncoderState::Writing; } else {