Skip to main content

TryCloneToOwned

Trait TryCloneToOwned 

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

    // Required method
    fn try_clone_to_owned(&self) -> Result<Self::Owned, Self::Error>;
}
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 Error

The error type returned when cloning fails.

Required Methods§

Source

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

Attempts to create an owned version of the value.

§Errors

Returns Error if cloning fails.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementations on Foreign Types§

Source§

impl TryCloneToOwned for BorrowedFd<'_>

Available on Unix and crate feature std and neither Hermit nor Motor OS nor Trusty nor WebAssembly only.

Implementors§