OptionNodeResultExt

Trait OptionNodeResultExt 

Source
pub trait OptionNodeResultExt<T> {
    // Required methods
    fn unwrap2(self) -> T;
    fn expect2(self, message: impl AsRef<str>) -> T;
    fn flatten(self) -> Option<T>;
}
Expand description

Useful trait to unwrap an Option<NodeResult<'tree, T>>

Required Methods§

Source

fn unwrap2(self) -> T

Unwrap the Option and then NodeResult, panic if either is None/Err.

Source

fn expect2(self, message: impl AsRef<str>) -> T

Unwrap the Option and then NodeResult, panic with the message if either is None/Err.

Source

fn flatten(self) -> Option<T>

Flatten into an Option, with None if the node is present but an incorrect kind.

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<'tree, T> OptionNodeResultExt<T> for Option<NodeResult<'tree, T>>

Source§

fn unwrap2(self) -> T

Source§

fn expect2(self, message: impl AsRef<str>) -> T

Source§

fn flatten(self) -> Option<T>

Implementors§