Trait munge::Restructure
source · [−]pub unsafe trait Restructure<T: ?Sized> {
type Restructured;
unsafe fn restructure(ptr: *mut Self) -> 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 same invariants as a mutably
borrowed subfield of some T
. These invariants must not be violated if simultaneous mutable
borrows exist to other subfields of the same T
.
Associated Types
type Restructured
type Restructured
The restructured version of this type.
Required methods
unsafe fn restructure(ptr: *mut Self) -> Self::Restructured
unsafe fn restructure(ptr: *mut Self) -> Self::Restructured
Restructures a pointer to this type into the target type.
Safety
ptr
must be a pointer to a subfield of some T
.