pub unsafe trait EmplaceExt<T, R: Region>: Emplace<T, R>where
    T: DropRaw + Pointee + ?Sized,
{ fn emplace_unsized(self, out: In<Slot<'_, T>, R>); fn emplace(self, out: In<Slot<'_, T>, R>)
    where
        T: Sized
; unsafe fn emplace_mut_unsized(
        self,
        out: In<Slot<'_, T>, R>
    ) -> In<Mut<'_, T>, R>; fn emplace_mut(self, out: In<Slot<'_, T>, R>) -> In<Mut<'_, T>, R>; unsafe fn emplace_val_unsized(
        self,
        out: In<Slot<'_, T>, R>
    ) -> In<Val<'_, T>, R>; fn emplace_val(self, out: In<Slot<'_, T>, R>) -> In<Val<'_, T>, R>
    where
        T: Sized
; }
Expand description

An extension trait for Emplace that provides a variety of convenient emplacement methods.

Safety

emplace_val_unsized and emplace_val must initialize out and return it as a Val.

Required Methods

Emplaces a value into a given slot within some memory region.

Panics

Panics if out does not have the metadata returned by emplaced_meta.

Emplaces a sized value into a given slot within some memory region.

This simply wraps a call to emplace_unsized_unchecked. Because T is Sized, the metadata of the slot’s pointer must always match the metadata returned from emplaced_meta, and so it is safe.

Emplaces a value into a given slot within some memory region and returns a mutable reference.

Safety

out must have the metadata returned by emplaced_meta.

Emplaces a sized value into a given slot within some memory region and returns a mutable reference.

Emplaces a value into a given slot within some memory region and returns an initialized value.

Safety

out must have the metadata returned by emplaced_meta.

Emplaces a sized value into a given slot within some memory region and returns an initialized value.

This simply wraps a call to emplace_val_unsized. Because T is sized, the metadata of the slot’s pointer must always match the metadata returned from emplaced_meta, and so it is safe.

Implementors