Skip to main content

OptionResultOptionExt

Trait OptionResultOptionExt 

Source
pub trait OptionResultOptionExt<T, E> {
    // Required method
    fn sequence_opt(self) -> Result<Option<T>, E>;
}
Expand description

Extends optional results containing optional values with filtered sequencing.

Required Methods§

Source

fn sequence_opt(self) -> Result<Option<T>, E>

Similar to sequence, but with inner value wrapped inside Option so it has effect of filtering None values.

§Examples
use alux_traversable::*;

let r: Result<_, ()> = Some(Ok(Some(42))).sequence_opt();

assert_eq!(r, Ok(Some(42)));

Dyn Compatibility§

This trait is dyn compatible.

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

Implementations on Foreign Types§

Source§

impl<T, E> OptionResultOptionExt<T, E> for Option<Result<Option<T>, E>>

Extends optional results containing optional values with filtered sequencing.

Source§

fn sequence_opt(self) -> Result<Option<T>, E>

Similar to sequence, but with inner value wrapped inside Option so it has effect of filtering None values.

§Examples
use alux_traversable::*;

let r: Result<_, ()> = Some(Ok(Some(42))).sequence_opt();

assert_eq!(r, Ok(Some(42)));

Implementors§