Trait insideout::InsideOut [] [src]

pub trait InsideOut {
    type Output;
    fn inside_out(self) -> Self::Output;
}

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)));
}

Associated Types

Required Methods

Implementations on Foreign Types

impl<T, E> InsideOut for Option<Result<T, E>>
[src]

[src]

impl<T, E> InsideOut for Result<Option<T>, E>
[src]

[src]

Implementors