pub trait Newtype {
type Inner;
// Required methods
fn new(inner: Self::Inner) -> Self;
fn into_inner(self) -> Self::Inner;
}Expand description
Newtype trait defines conversions from and into the inner type.
This trait is automatically derived for all types annotated with
#[derive(Newtype)].
Required Associated Types§
Required Methods§
Sourcefn new(inner: Self::Inner) -> Self
fn new(inner: Self::Inner) -> Self
Creates a new newtype instance from the inner representation.
Sourcefn into_inner(self) -> Self::Inner
fn into_inner(self) -> Self::Inner
Unwraps the value, consuming the newtype.
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.