[][src]Trait genie_support::MapInto

pub trait MapInto<T> {
    fn map_into(self) -> T;
}

Helper trait to map a container of T to a container of some type F that implements From.

For example, Result to Result<From>, or Option to Option<From>.

Required methods

fn map_into(self) -> T

Map the contained T into a different type.

Essentially, .map_into() is the same as doing .map(|val| val.into()).

Example

use genie_support::MapInto;

let a: Option<u8> = Some(10);
let b: Option<u16> = a.map_into();
assert_eq!(b, Some(10u16));
Loading content...

Implementations on Foreign Types

impl<Source, Target, Error> MapInto<Result<Target, Error>> for Result<Source, Error> where
    Target: From<Source>, 
[src]

impl<Source, Target> MapInto<Option<Target>> for Option<Source> where
    Target: From<Source>, 
[src]

Loading content...

Implementors

Loading content...