TryCloneToOwned

Trait TryCloneToOwned 

Source
pub trait TryCloneToOwned: Sized {
    type Owned;
    type Err;

    // Required method
    fn try_clone_to_owned(&self) -> Result<Self::Owned, Self::Err>;
}
Expand description

A trait for fallibly cloning a value into an owned form.

This is similar in spirit to ToOwned, but allows the conversion to fail and does not require Owned to implement Clone.

Required Associated Types§

Source

type Owned

The owned type produced by cloning.

Source

type Err

The error type returned when cloning fails.

Required Methods§

Source

fn try_clone_to_owned(&self) -> Result<Self::Owned, Self::Err>

Attempts to create an owned version of the value.

§Errors

Returns Err if cloning fails.

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 TryCloneToOwned for BorrowedFd<'_>

Available on crate feature std and Unix and neither WebAssembly nor HermitCore nor target_os=trusty nor target_os=motor only.

Implementors§