Trait insideout::InsideOut

source ·
pub trait InsideOut {
    type Output;

    fn inside_out(self) -> Self::Output;
}
Expand description

Wrap composed types inside-out

use insideout::InsideOut;

fn main() {
    let maybe_result: Option<Result<_, ()>> = Some(Ok(1));
    assert_eq!(maybe_result.inside_out(), Ok(Some(1)));
    let result_maybe: Result<Option<i16>, &'static str> = Err("foo");
    assert_eq!(result_maybe.inside_out(), Some(Err("foo")));
    let result_maybe: Result<Option<_>, &'static str> = Ok(Some(3i16));
    assert_eq!(result_maybe.inside_out(), Some(Ok(3)));
}

Required Associated Types§

Required Methods§

Implementations on Foreign Types§

Implementors§