Trait TryClone

Source
pub trait TryClone {
    // Required method
    fn try_clone(&self) -> Result<Self, TryReserveError>
       where Self: Sized;
}
Expand description

trait for trying to clone an elem, return an error instead of panic if allocation failed

§Examples

use fallible_collections::TryClone;
let mut vec = vec![42, 100];
assert_eq!(vec.try_clone().unwrap(), vec)

Required Methods§

Source

fn try_clone(&self) -> Result<Self, TryReserveError>
where Self: Sized,

try clone method, (Self must be sized because of Result constraint)

Implementations on Foreign Types§

Source§

impl TryClone for bool

Source§

fn try_clone(&self) -> Result<Self, TryReserveError>
where Self: Sized,

Source§

impl TryClone for i8

Source§

fn try_clone(&self) -> Result<Self, TryReserveError>
where Self: Sized,

Source§

impl TryClone for i16

Source§

fn try_clone(&self) -> Result<Self, TryReserveError>
where Self: Sized,

Source§

impl TryClone for i32

Source§

fn try_clone(&self) -> Result<Self, TryReserveError>
where Self: Sized,

Source§

impl TryClone for i64

Source§

fn try_clone(&self) -> Result<Self, TryReserveError>
where Self: Sized,

Source§

impl TryClone for isize

Source§

fn try_clone(&self) -> Result<Self, TryReserveError>
where Self: Sized,

Source§

impl TryClone for u8

Source§

fn try_clone(&self) -> Result<Self, TryReserveError>
where Self: Sized,

Source§

impl TryClone for u16

Source§

fn try_clone(&self) -> Result<Self, TryReserveError>
where Self: Sized,

Source§

impl TryClone for u32

Source§

fn try_clone(&self) -> Result<Self, TryReserveError>
where Self: Sized,

Source§

impl TryClone for u64

Source§

fn try_clone(&self) -> Result<Self, TryReserveError>
where Self: Sized,

Source§

impl TryClone for usize

Source§

fn try_clone(&self) -> Result<Self, TryReserveError>
where Self: Sized,

Source§

impl<T: TryClone> TryClone for Option<T>

Source§

impl<T: TryClone> TryClone for Box<T>

Source§

impl<T: TryClone> TryClone for Vec<T>

Source§

fn try_clone(&self) -> Result<Self, TryReserveError>
where Self: Sized,

Source§

impl<T: ?Sized> TryClone for Arc<T>

Just a TryClone boilerplate for Arc

Implementors§

Source§

impl<K, V> TryClone for TryHashMap<K, V>
where K: Eq + Hash + TryClone, V: TryClone,

Source§

impl<T: TryClone> TryClone for TryBox<T>

Source§

impl<T: TryClone> TryClone for TryVec<T>