try-clone 0.2.0

Fallible cloning.
Documentation
1
2
3
4
5
6
7
8
9
10
11
#[cfg(not(feature = "blanket-impl"))]
use crate::TryClone;

#[cfg(not(feature = "blanket-impl"))]
impl<T: TryClone> TryClone for Option<T> {
    type Error = T::Error;

    fn try_clone(&self) -> Result<Self, Self::Error> {
        self.as_ref().map(crate::try_clone).transpose()
    }
}