pub trait Emplace<T>: Sized + Deref {
type Output: Deref<Target = Self::Target>;
// Required method
fn try_emplace<N: TryNew<Output = T>>(
n: N,
) -> Result<Self::Output, N::Error>;
// Provided method
fn emplace<N: New<Output = T>>(n: N) -> Self::Output { ... }
}Expand description
A pointer type that may be “emplaced” as a stable address which a New may be used to
construct a value with.
The Emplace<T>::Output type is usually either Self or Pin<Self> depending on the API of
Self with respect to DerefMut.
For example, Arc<T>, Box<T>, and Rc<T> are all Emplace<T, Output = Pin<Self>>.
However, cxx::UniquePtr<T>: Emplace<T, Output = Self>, since cxx::UniquePtr<T> already only
allows obtaining pinned mutable references to T due to its more restrictive API, and hence
cxx::UniquePtr<T> does not need to be pinned itself.
Required Associated Types§
Required Methods§
Provided Methods§
Object Safety§
This trait is not object safe.