Skip to main content

OptionExt

Trait OptionExt 

Source
pub trait OptionExt<T> {
    // Required methods
    fn or_exit(self) -> T;
    fn _elog(self, _: &str) -> T;
    fn elog<E: Display>(self, _: E) -> Result<T, E>;
    fn wlog<E: Display>(self, _: E) -> Result<T, E>;
}

Required Methods§

Source

fn or_exit(self) -> T

Unwrap or exit

Source

fn _elog(self, _: &str) -> T

Unwrap or log and exit

Source

fn elog<E: Display>(self, _: E) -> Result<T, E>

Log the error if None, then transform to a Result.

Source

fn wlog<E: Display>(self, _: E) -> Result<T, E>

Log the error as a warning if None, then transform to a Result.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementations on Foreign Types§

Source§

impl<T> OptionExt<T> for Option<T>

Source§

fn or_exit(self) -> T

Source§

fn _elog(self, s: &str) -> T

Source§

fn elog<E: Display>(self, err: E) -> Result<T, E>

Source§

fn wlog<E: Display>(self, err: E) -> Result<T, E>

Implementors§