Trait std::ops::Boxed [] [src]

pub trait Boxed {
    type Data;
    type Place: BoxPlace<Self::Data>;
    unsafe fn finalize(filled: Self::Place) -> Self;
}
Unstable

Core trait for the box EXPR`box EXPR` form.

box EXPR`box EXPR` effectively desugars into:

fn main() { let mut place = BoxPlace::make_place(); let raw_place = Place::pointer(&mut place); let value = EXPR; unsafe { ::std::ptr::write(raw_place, value); Boxed::finalize(place) } }
let mut place = BoxPlace::make_place();
let raw_place = Place::pointer(&mut place);
let value = EXPR;
unsafe {
    ::std::ptr::write(raw_place, value);
    Boxed::finalize(place)
}

The type of box EXPR`box EXPRis supplied from its surrounding context; in the above expansion, the result typeTis used to determine which implementation ofBoxedto use, and thatin turn dictates determines which implementation ofBoxPlaceto use, namely:<::Place as BoxPlace>`.

Associated Types

type Data

Unstable

The kind of data that is stored in this kind of box.

type Place: BoxPlace<Self::Data>

Unstable

The place that will negotiate the storage of the data.

Required Methods

unsafe fn finalize(filled: Self::Place) -> Self

Unstable

Converts filled place into final owning value, shifting deallocation/cleanup responsibilities (if any remain), over to returned instance of Self`Selfand forgettingfilled`.

Implementors