pub trait Placer<Data> where Data: ?Sized { type Place: InPlace<Data>; fn make_place(self) -> Self::Place; }
Interface to implementations of PLACE <- EXPR
.
PLACE <- EXPR
effectively desugars into:
let p = PLACE; let mut place = Placer::make_place(p); let raw_place = Place::pointer(&mut place); let value = EXPR; unsafe { std::ptr::write(raw_place, value); InPlace::finalize(place) }
The type of PLACE <- EXPR
is derived from the type of PLACE
; if the type of PLACE
is P
, then the final type of the whole expression is P::Place::Owner
(see the InPlace
and Boxed
traits).
Values for types implementing this trait usually are transient intermediate values (e.g. the return value of Vec::emplace_back
) or Copy
, since the make_place
method takes self
by value.
type Place: InPlace<Data>
Place
is the intermedate agent guarding the uninitialized state for Data
.
fn make_place(self) -> Self::Place
Creates a fresh place from self
.
impl<'a, T> Placer<T> for &'a mut BinaryHeap<T> where T: 'a + Clone + Ord
impl<'a, T> Placer<T> for FrontPlace<'a, T>
impl<'a, T> Placer<T> for BackPlace<'a, T>
impl<'a, T> Placer<T> for PlaceBack<'a, T>
impl<T> Placer<T> for ExchangeHeapSingleton
© 2010 The Rust Project Developers
Licensed under the Apache License, Version 2.0 or the MIT license, at your option.
https://doc.rust-lang.org/std/ops/trait.Placer.html