Trait munge::Restructure
source · [−]pub unsafe trait Restructure<T: ?Sized> {
type Restructured;
unsafe fn restructure(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 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.
Required Associated Types
type Restructured
type Restructured
The restructured version of this type.
Required Methods
unsafe fn restructure(ptr: *mut T) -> Self::Restructured
unsafe fn restructure(ptr: *mut T) -> Self::Restructured
Restructures a pointer to this type into the target type.
Safety
ptr must be a properly aligned pointer to a subfield of some T.