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 u32

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 u8

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 i8

source§

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

source§

impl TryClone for bool

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

source§

impl TryClone for usize

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 i64

source§

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

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 TryClone for isize

source§

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

source§

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

source§

impl TryClone for i32

source§

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

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>