ownership 0.3.0

Obtaining ownership.
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
use crate::IntoOwned;

impl<T: IntoOwned> IntoOwned for Option<T> {
    type Owned = Option<T::Owned>;

    fn into_owned(self) -> Self::Owned {
        self.map(IntoOwned::into_owned)
    }
}

impl<T: IntoOwned, E: IntoOwned> IntoOwned for Result<T, E> {
    type Owned = Result<T::Owned, E::Owned>;

    fn into_owned(self) -> Self::Owned {
        self.map(IntoOwned::into_owned)
            .map_err(IntoOwned::into_owned)
    }
}