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.

Object Safety§

This trait is not object safe.

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