# Trait std::ops::Place [−] [src]

    pub unsafe trait Place<Data> where
        Data: ?Sized, {
        fn pointer(&mut self) -> *mut Data;
    }

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

Both `PLACE <- EXPR` and `box EXPR` desugar into expressions that allocate an intermediate "place" that holds uninitialized state. The desugaring evaluates EXPR, and writes the result at the address returned by the `pointer` method of this trait.

A `Place` can be thought of as a special representation for a hypothetical `&uninit` reference (which Rust cannot currently express directly). That is, it represents a pointer to uninitialized storage.

The client is responsible for two steps: First, initializing the payload (it can access its address via `pointer`). Second, converting the agent to an instance of the owning pointer, via the appropriate `finalize` method (see the `InPlace`.

If evaluating EXPR fails, then it is up to the destructor for the implementation of Place to clean up any intermediate state (e.g. deallocate box storage, pop a stack, etc).

## Required Methods

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

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

This function must return a pointer through which a value of type `Data` can be written.

## Implementors

- [src]
  `impl<'a, T> Place<T> for PlaceFront<'a, T>`
- [src]
  `impl<'a, T> Place<T> for std::collections::vec_deque::PlaceBack<'a, T>`
- [src]
  `impl<T> Place<T> for IntermediateBox<T>`
- [src]
  `impl<'a, T> Place<T> for std::vec::PlaceBack<'a, T>`
- [src]
  `impl<'a, T> Place<T> for FrontPlace<'a, T>`
- [src]
  `impl<'a, T> Place<T> for BackPlace<'a, T>`
- [src]
  `impl<'a, T> Place<T> for BinaryHeapPlace<'a, T> where
  T: Clone + Ord,`
- [src]
  `impl<'a, K, V> Place<V> for EntryPlace<'a, K, V>`

# Help

## Keyboard Shortcuts

`?`
  Show this help dialog
`S`
  Focus the search field
`↑`
  Move up in search results
`↓`
  Move down in search results
`↹`
  Switch tab
`⏎`
  Go to active search result
`+`
  Expand all sections
`-`
  Collapse 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`)