TryClone

Trait TryClone 

Source
pub trait TryClone: Sized {
    type Error: Error;

    // Required method
    fn try_clone(&self) -> Result<Self, Self::Error>;
}
Expand description

Types that can be cloned where success is not guaranteed can implement this trait.

Required Associated Types§

Source

type Error: Error

The type of error that can be returned when an attempted clone operation fails.

Required Methods§

Source

fn try_clone(&self) -> Result<Self, Self::Error>

Attempt to clone this instance.

§Errors

Can fail if the underlying instance cannot be cloned (e.g. the OS could be out of file descriptors, or some low-level OS-specific error could be produced).

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementations on Foreign Types§

Source§

impl TryClone for TcpStream

Source§

type Error = Error

Source§

fn try_clone(&self) -> Result<Self, Self::Error>

Implementors§