pub struct UninitAlloc<T>where
    T: ?Sized,
{ /* private fields */ }
Expand description

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>.

Implementations

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.

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

Formats the value using the given formatter. Read more
Executes the destructor for this type. Read more
Converts to this type from the input type.
Converts to this type from the input type.
Converts to this type from the input type.

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more
Immutably borrows from an owned value. Read more
Mutably borrows from an owned value. Read more

Returns the argument unchanged.

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

The type returned in the event of a conversion error.
Performs the conversion.
The type returned in the event of a conversion error.
Performs the conversion.