pub trait TryClone : Sized {
type Error;
fn try_clone(&self) -> Result<Self, Self::Error>;
#[inline]
fn try_clone_from(&mut self, source: &Self) -> Result<(), Self::Error> {
Ok(*self = source.try_clone()?)
}
}
impl<T: Clone> TryClone for T {
type Error = crate::Infallible;
#[inline]
fn try_clone(&self) -> Result<Self, Self::Error> {
Ok(self.clone())
}
#[inline]
fn try_clone_from(&mut self, source: &Self) -> Result<(), Self::Error> {
Ok(self.clone_from(source))
}
}