pub trait Wrapper: RawWrapper {
// Required methods
fn from_value(value: Self::Item) -> Self;
fn into_inner(self) -> Self::Item;
fn get(&self) -> &Self::Item;
fn get_mut(&mut self) -> &mut Self::Item;
// Provided method
fn new() -> Self
where Self: Sized,
Self::Item: Default { ... }
}Expand description
The Wrapper trait is used to establish a common interface for all simplemented
structures that “wrap” a single value. Essentially, any type capable of implementing
#[repr(transparent)] can be considered a wrapper.
Required Methods§
Sourcefn from_value(value: Self::Item) -> Self
fn from_value(value: Self::Item) -> Self
returns a new instance of the wrapper initialized with the given value
Sourcefn into_inner(self) -> Self::Item
fn into_inner(self) -> Self::Item
consumes the wrapper to return the stored value
Provided Methods§
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.