Skip to main content

TryExpect

Trait TryExpect 

Source
pub trait TryExpect<Item>
where Item: Send, Self: Send + Sized,
{ // Required methods fn expect_ok(self) -> impl Stream<Item = Item> + Send; fn map_expect(self, msg: &str) -> impl Stream<Item = Item> + Send; }
Expand description

Converts fallible stream items into values by expecting success.

Successful items pass through in source order. Errors terminate the current poll by panicking with either a default or caller-supplied message.

Required Methods§

Source

fn expect_ok(self) -> impl Stream<Item = Item> + Send

Expects every stream item with the default failure message.

Successful values are unwrapped lazily as the stream is polled. The default message identifies a stream expectation failure.

§Panics

Panics when the source stream yields an error.

Source

fn map_expect(self, msg: &str) -> impl Stream<Item = Item> + Send

Expects every stream item with msg as the failure message.

Successful values are unwrapped lazily as the stream is polled. The supplied message is used for every failing item.

§Panics

Panics when the source stream yields an error.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§

Source§

impl<Item, S> TryExpect<Item> for S
where S: Stream<Item = Result<Item>> + Send + TryStream, Item: Send, Self: Send + Sized,