Skip to main content

TryIgnore

Trait TryIgnore 

Source
pub trait TryIgnore<Item>
where Item: Send, Self: Send + Sized,
{ // Required methods fn ignore_err(self) -> impl Stream<Item = Item> + Send; fn ignore_ok(self) -> impl Stream<Item = Error> + Send; }
Expand description

Selects successful or failed items from a result stream.

Success selection asserts error-free input when debug assertions are enabled and filters errors when they are disabled. Error selection always discards successful items.

Required Methods§

Source

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

Yields successful values while conditionally ignoring errors.

Errors are filtered when debug assertions are disabled. When they are enabled, each item is expected to be successful so accidental error loss remains visible.

§Panics

Panics when debug assertions are enabled and the source yields an error.

Source

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

Yields errors while ignoring successful values.

Successful items are filtered out as the stream is polled. Errors retain their source order and value.

Dyn Compatibility§

This trait is not dyn compatible.

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

Implementors§

Source§

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