Trait not_found_error::Require

source ·
pub trait Require {
    type T;

    // Required method
    fn require(self) -> Result<Self::T, NotFoundError<Self::T>>;
}
Expand description

An extension trait for Option<T> to convert it to Result<T, NotFoundError<T>>

§Examples

let item = items.first().require();

§See also

  • require: Function to convert Option<T> to Result<T, NotFoundError<T>>
  • OkOrNotFound: Trait for converting Option<T> to Result<T, NotFoundError<AnotherType>>

Required Associated Types§

source

type T

Required Methods§

source

fn require(self) -> Result<Self::T, NotFoundError<Self::T>>

Implementations on Foreign Types§

source§

impl<T> Require for Option<T>

§

type T = T

source§

fn require(self) -> Result<Self::T, NotFoundError<Self::T>>

Implementors§