PostfixAssertOption

Trait PostfixAssertOption 

Source
pub trait PostfixAssertOption: Sealed {
    // Required methods
    fn assert_some(self) -> Self;
    fn assert_none(self) -> Self;
}
Expand description

Describes the assert_* methods for std::option::Option<T>

This trait is sealed to allow for additional assertion methods in the future. As such, this trait cannot be implemented by the user.

Required Methods§

Source

fn assert_some(self) -> Self

This checks the Option given and panics if it is not a Some(T). Otherwise it just returns the option back to you.

Source

fn assert_none(self) -> Self

This checks the Option given and panics if it is not None. Otherwise it just returns the option back to you.

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> PostfixAssertOption for &Option<T>

Source§

fn assert_some(self) -> Self

Source§

fn assert_none(self) -> Self

Source§

impl<T> PostfixAssertOption for Option<T>

Source§

fn assert_some(self) -> Self

Source§

fn assert_none(self) -> Self

Implementors§