[][src]Struct owned_alloc::UninitAlloc

pub struct UninitAlloc<T> where
    T: ?Sized
{ /* fields omitted */ }

Dynamic allocation of a T whose memory is considered uninitialized. The allocation is freed on drop. If the size of the allocation is zero, no allocation is performed and a dangling pointer is used (just like in std). For the drop checker, the type acts as if it contains a T due to usage of PhantomData<T>.

Methods

impl<T> UninitAlloc<T>
[src]

Creates room for a T. In case of allocation error, the handler registered via stdlib is called.

Creates room for a T. In case of allocation error, Err is returned.

Initializes the memory and returns the allocation now considered initialized.

impl<T> UninitAlloc<T> where
    T: ?Sized
[src]

Calls a function with a mutable reference to uninitialized memory and returns the allocation now considered initialized. The passed function is expected to initialize the memory.

Safety

This function is unsafe because the passed function might not initialize the memory correctly.

Recreate the UninitAlloc from a raw non-null pointer.

Safety

This functions is unsafe because passing the wrong pointer leads to undefined behaviour.

Returns the raw non-null pointer of the allocation.

"Forgets" dropping the allocation and returns its raw non-null pointer.

Trait Implementations

impl<T: ?Sized> Sync for UninitAlloc<T> where
    T: Sync
[src]

impl<T> From<RawVec<T>> for UninitAlloc<[T]>
[src]

impl<T> From<UninitAlloc<T>> for RawVec<T>
[src]

impl<T> From<UninitAlloc<T>> for MaybeUninitAlloc<T> where
    T: ?Sized
[src]

impl<T: ?Sized> Send for UninitAlloc<T> where
    T: Send
[src]

impl<T> Drop for UninitAlloc<T> where
    T: ?Sized
[src]

impl<T> Debug for UninitAlloc<T> where
    T: ?Sized
[src]

Blanket Implementations

impl<T> From for T
[src]

impl<T, U> Into for T where
    U: From<T>, 
[src]

impl<T, U> TryFrom for T where
    T: From<U>, 
[src]

🔬 This is a nightly-only experimental API. (try_from)

The type returned in the event of a conversion error.

impl<T> Borrow for T where
    T: ?Sized
[src]

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T, U> TryInto for T where
    U: TryFrom<T>, 
[src]

🔬 This is a nightly-only experimental API. (try_from)

The type returned in the event of a conversion error.

impl<T> BorrowMut for T where
    T: ?Sized
[src]