[][src]Trait slice_dst::TryAllocSliceDst

pub unsafe trait TryAllocSliceDst<S: ?Sized + SliceDst>: AllocSliceDst<S> + Sized {
    unsafe fn try_new_slice_dst<I, E>(len: usize, init: I) -> Result<Self, E>
    where
        I: FnOnce(NonNull<S>) -> Result<(), E>
; }

Types that can allocate a custom slice DST within them, given a fallible initialization function.

Required methods

unsafe fn try_new_slice_dst<I, E>(len: usize, init: I) -> Result<Self, E> where
    I: FnOnce(NonNull<S>) -> Result<(), E>, 

Create a new custom slice DST with a fallible initialization function.

Safety

init must properly initialize the object behind the pointer. init receives a fully uninitialized pointer and must not read anything before writing.

If the initialization closure panics or returns an error, the allocated place will be deallocated but not dropped. To clean up the partially initialized type, we suggest proxying creation through scope guarding types.

Loading content...

Implementations on Foreign Types

impl<S: ?Sized + SliceDst> TryAllocSliceDst<S> for Box<S>[src]

impl<S: ?Sized + SliceDst> TryAllocSliceDst<S> for Rc<S>[src]

impl<S: ?Sized + SliceDst> TryAllocSliceDst<S> for Arc<S>[src]

Loading content...

Implementors

Loading content...