alloc::boxed::IntermediateBox - Rust
Description: API documentation for the Rust `IntermediateBox` struct in crate `alloc`.
Keywords: rust, rustlang, rust-lang, IntermediateBox

# Struct alloc::boxed::IntermediateBox [−] [src]

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

🔬 This is a nightly-only experimental API. (`placement_in` #27779)

placement box design is still being worked out.

`IntermediateBox` represents uninitialized backing storage for `Box`.

FIXME (pnkfelix): Ideally we would just reuse `Box<T>` instead of introducing a separate `IntermediateBox<T>`; but then you hit issues when you e.g. attempt to destructure an instance of `Box`, since it is a lang item and so it gets special handling by the compiler. Easier just to make this parallel type for now.

FIXME (pnkfelix): Currently the `box` protocol only supports creating instances of sized types. This IntermediateBox is designed to be forward-compatible with a future protocol that supports creating instances of unsized types; that is why the type parameter has the `?Sized` generalization marker, and is also why this carries an explicit size. However, it probably does not need to carry the explicit alignment; that is just a work-around for the fact that the `align_of` intrinsic currently requires the input type to be Sized (which I do not think is strictly necessary).

## Trait Implementations

### `impl<T> Place<T> for IntermediateBox<T>`
[src]

#### `fn pointer(&mut self) -> *mut T`

🔬 This is a nightly-only experimental API. (`placement_new_protocol` #27779)

Returns the address where the input value will be written. Note that the data at this address is generally uninitialized, and thus one should use `ptr::write` for initializing it. Read more

### `impl<T> BoxPlace<T> for IntermediateBox<T>`
[src]

#### `fn make_place() -> IntermediateBox<T>`

🔬 This is a nightly-only experimental API. (`placement_new_protocol` #27779)

Creates a globally fresh place.

### `impl<T> InPlace<T> for IntermediateBox<T>`
[src]

#### `type Owner = Box<T>`

🔬 This is a nightly-only experimental API. (`placement_new_protocol` #27779)

`Owner` is the type of the end value of `PLACE <- EXPR` Read more

#### `unsafe fn finalize(self) -> Box<T>`

🔬 This is a nightly-only experimental API. (`placement_new_protocol` #27779)

Converts self into the final value, shifting deallocation/cleanup responsibilities (if any remain), over to the returned instance of `Owner` and forgetting self. Read more

### `impl<T: ?Sized> Drop for IntermediateBox<T>`
[src]

#### `fn drop(&mut self)`

A method called when the value goes out of scope. Read more

# Help

## Keyboard Shortcuts

?
  Show this help dialog
S
  Focus the search field
⇤
  Move up in search results
⇥
  Move down in search results
⏎
  Go to active search result
+
  Collapse/expand all sections

## Search Tricks

Prefix searches with a type followed by a colon (e.g. `fn:`) to restrict the search to a given type.

Accepted types are: `fn`, `mod`, `struct`, `enum`, `trait`, `type`, `macro`, and `const`.

Search functions by type signature (e.g. `vec -> usize` or `* -> vec`)