Skip to main content

WrappedCreateFrom

Trait WrappedCreateFrom 

Source
pub trait WrappedCreateFrom<FromType, ToType> {
    // Required method
    fn take(x: FromType) -> ToType;

    // Provided method
    fn take_from(dest: &mut ToType, x: FromType) { ... }
}
Expand description

The purpose of this trait is to create a new value of a passed object, when the passed object is the value, simply move the value; when the passed object is the reference, create the new value by clone. Other extension is possible.

The trait is used by ChildrenTable and slab.

Required Methods§

Source

fn take(x: FromType) -> ToType

Provided Methods§

Source

fn take_from(dest: &mut ToType, x: FromType)

Unoptimized default implementation.

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<'x, T: Clone> WrappedCreateFrom<&'x T, UnsafeCell<T>> for UnsafeCell<T>

Source§

fn take(val: &'x T) -> UnsafeCell<T>

Source§

fn take_from(dest: &mut UnsafeCell<T>, x: &'x T)

Implementors§

Source§

impl<E: EntryTrait> WrappedCreateFrom<<E as EntryTrait>::EntryType, E> for E