pub unsafe trait Destructure: Sized {
type Underlying: ?Sized;
type Destructuring: Destructuring;
// Required method
fn underlying(&mut self) -> *mut Self::Underlying;
}
Expand description
A type that can be destructured into its constituent parts.
See the crate docs for an example of implementing
Destructure
and Restructure
.
§Safety
Destructuring
must reflect the type of destructuring allowed for the type:underlying
must return a pointer that is non-null, properly aligned, and valid for reads.
Required Associated Types§
Sourcetype Underlying: ?Sized
type Underlying: ?Sized
The underlying type that is destructured.
Sourcetype Destructuring: Destructuring
type Destructuring: Destructuring
The type of destructuring to perform.
Required Methods§
Sourcefn underlying(&mut self) -> *mut Self::Underlying
fn underlying(&mut self) -> *mut Self::Underlying
Returns a mutable pointer to the underlying type.
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.