# [−][src]Enum std::alloc::AllocInit

    pub enum AllocInit {
        Uninitialized,
        Zeroed,
    }

🔬 This is a nightly-only experimental API. (`allocator_api` #32838)

A desired initial state for allocated memory.

## Variants

`Uninitialized`
🔬 This is a nightly-only experimental API. (`allocator_api` #32838)

The contents of the new memory are uninitialized.

`Zeroed`
🔬 This is a nightly-only experimental API. (`allocator_api` #32838)

The new memory is guaranteed to be zeroed.

## Implementations

### `impl AllocInit`[src]

#### `pub unsafe fn init(self, memory: MemoryBlock)`[src]

🔬 This is a nightly-only experimental API. (`allocator_api` #32838)

Initialize the specified memory block.

This behaves like calling `AllocInit::init_offset(memory, 0)`.

# Safety

- `memory.ptr` must be valid for writes of `memory.size` bytes.

#### `pub unsafe fn init_offset(self, memory: MemoryBlock, offset: usize)`[src]

🔬 This is a nightly-only experimental API. (`allocator_api` #32838)

Initialize the memory block like specified by `init` at the specified `offset`.

This is a no-op for `AllocInit::Uninitialized` and writes zeroes for `AllocInit::Zeroed` at `ptr + offset` until `ptr + layout.size()`.

# Safety

- `memory.ptr` must be valid for writes of `memory.size` bytes.
- `offset` must be smaller than or equal to `memory.size`

## Trait Implementations

### `impl Clone for AllocInit`[src]

#### `fn clone(&self) -> AllocInit`[src]

Returns a copy of the value. Read more

#### `fn clone_from(&mut self, source: &Self)`1.0.0[src]

Performs copy-assignment from `source`. Read more

### `impl Copy for AllocInit`[src]

### `impl Debug for AllocInit`[src]

#### `fn fmt(&self, f: &mut Formatter) -> Result<(), Error>`[src]

Formats the value using the given formatter. Read more

### `impl Eq for AllocInit`[src]

### `impl PartialEq<AllocInit> for AllocInit`[src]

#### `fn eq(&self, other: &AllocInit) -> bool`[src]

This method tests for `self` and `other` values to be equal, and is used by `==`. Read more

#### `#[must_use]fn ne(&self, other: &Rhs) -> bool` 1.0.0[src]

This method tests for `!=`.

### `impl StructuralEq for AllocInit`[src]

### `impl StructuralPartialEq for AllocInit`[src]

## Auto Trait Implementations

### `impl RefUnwindSafe for AllocInit`

### `impl Send for AllocInit`

### `impl Sync for AllocInit`

### `impl Unpin for AllocInit`

### `impl UnwindSafe for AllocInit`

## Blanket Implementations

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

#### `fn type_id(&self) -> TypeId`[src]

Gets the `TypeId` of `self`. Read more

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

#### `fn borrow(&self) -> &T`[src]

Immutably borrows from an owned value. Read more

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

#### `fn borrow_mut(&mut self) -> &mut T`[src]

Mutably borrows from an owned value. Read more

### `impl<T> From<T> for T`[src]

#### `fn from(t: T) -> T`[src]

Performs the conversion.

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

#### `fn into(self) -> U`[src]

Performs the conversion.

### `impl<T> ToOwned for T where
T: Clone,` [src]

#### `type Owned = T`

The resulting type after obtaining ownership.

#### `fn to_owned(&self) -> T`[src]

Creates owned data from borrowed data, usually by cloning. Read more

#### `fn clone_into(&self, target: &mut T)`[src]

🔬 This is a nightly-only experimental API. (`toowned_clone_into` #41263)

recently added

Uses borrowed data to replace owned data, usually by cloning. Read more

### `impl<T, U> TryFrom<U> for T where
U: Into<T>,` [src]

#### `type Error = Infallible`

The type returned in the event of a conversion error.

#### `fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>`[src]

Performs the conversion.

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

#### `type Error = <U as TryFrom<T>>::Error`

The type returned in the event of a conversion error.

#### `fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>`[src]

Performs the conversion.