pub unsafe trait Restructure<T: ?Sized>: Destructure {
    type Restructured;

    unsafe fn restructure(&self, ptr: *mut T) -> Self::Restructured;
}
Expand description

A type that can be “restructured” as a field of some containing type.

Safety

restructure must return a valid Restructured that upholds the invariants for its Destructuring:

  • If the type is destructured by ref, then the Restructured value must behave as a disjoint borrow of a field of the underlying type.
  • If the type is destructured by value, then the Restructured value must behave as taking ownership of the fields of the underlying type.

Required Associated Types

The restructured version of this type.

Required Methods

Restructures a pointer to this type into the target type.

Safety

ptr must be a properly aligned pointer to a subfield of the pointer underlying self.

Implementations on Foreign Types

Implementors