pub trait Equivalent<T>: Sized {
// Required methods
fn into_equivalent(self) -> T;
fn from_equivalent(object: T) -> Self;
}Expand description
Implemented if both types have the exact same layout.
This implies having the same MaybeHasNiche::MnArray.
This is represented as two-way conversion for two reasons:
- to highlight that the conversion is actual equivalence
- to increase flexibility (mostly to go around the orphan rule)
Required Methods§
Sourcefn into_equivalent(self) -> T
fn into_equivalent(self) -> T
Inverse of Equivalent::from_equivalent.
Sourcefn from_equivalent(object: T) -> Self
fn from_equivalent(object: T) -> Self
Inverse of Equivalent::into_equivalent.
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.