Trait core::ops::Place [] [src]

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

Both in (PLACE) EXPR and box EXPR`box EXPRdesugar into expressions that allocate an intermediate "place" that holds uninitialized state. The desugaring evaluates EXPR, and writes the result at the address returned by thepointer` method of this trait.

A Place`Placecan 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`pointer). Second, converting the agent to an instance of the owning pointer, via the appropriatefinalizemethod (see theInPlace`.

If evaluating EXPR fails, then 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

Unstable

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.

Implementors