proc_macro_error

Trait OptionExt

Source
pub trait OptionExt {
    type Some;

    // Required method
    fn expect_or_abort(self, msg: &str) -> Self::Some;
}
Expand description

This traits expands Option with some handy shortcuts.

Required Associated Types§

Required Methods§

Source

fn expect_or_abort(self, msg: &str) -> Self::Some

Behaves like Option::expect: if self is Some yield the contained value, otherwise abort macro execution via abort_call_site!. If it aborts the message will be used for compile_error! invocation.

Implementations on Foreign Types§

Source§

impl<T> OptionExt for Option<T>

Source§

type Some = T

Source§

fn expect_or_abort(self, message: &str) -> T

Implementors§