use futures::{Stream, StreamExt, TryStream}; use crate::Result; pub trait TryExpect<'a, Item> { fn expect_ok(self) -> impl Stream + Send + 'a; } impl<'a, T, Item> TryExpect<'a, Item> for T where T: Stream> + TryStream + Send + 'a, { #[inline] fn expect_ok(self: T) -> impl Stream + Send + 'a { self.map(|res| res.expect("stream expectation failure")) } }