[−][src]Trait slice_dst::TryAllocSliceDst
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>,
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.
Implementations on Foreign Types
impl<S: ?Sized + SliceDst> TryAllocSliceDst<S> for Box<S>
[src]
unsafe fn try_new_slice_dst<I, E>(len: usize, init: I) -> Result<Self, E> where
I: FnOnce(NonNull<S>) -> Result<(), E>,
[src]
I: FnOnce(NonNull<S>) -> Result<(), E>,
impl<S: ?Sized + SliceDst> TryAllocSliceDst<S> for Rc<S>
[src]
unsafe fn try_new_slice_dst<I, E>(len: usize, init: I) -> Result<Self, E> where
I: FnOnce(NonNull<S>) -> Result<(), E>,
[src]
I: FnOnce(NonNull<S>) -> Result<(), E>,
impl<S: ?Sized + SliceDst> TryAllocSliceDst<S> for Arc<S>
[src]
unsafe fn try_new_slice_dst<I, E>(len: usize, init: I) -> Result<Self, E> where
I: FnOnce(NonNull<S>) -> Result<(), E>,
[src]
I: FnOnce(NonNull<S>) -> Result<(), E>,