devela::_dep::rkyv::munge

Trait Destructure

pub unsafe trait Destructure: Sized {
    type Underlying: ?Sized;
    type Destructuring: Destructuring;

    // Required method
    fn underlying(&mut self) -> *mut Self::Underlying;
}
Available on crate feature dep_rkyv only.
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:
    • Borrow if the type is restructured by creating disjoint borrows of the fields of Underlying.
    • Move if the type may be restructured by moving the fields out of the destructured Underlying.
  • underlying must return a pointer that is non-null, properly aligned, and valid for reads.

Required Associated Types§

type Underlying: ?Sized

The underlying type that is destructured.

type Destructuring: Destructuring

The type of destructuring to perform.

Required Methods§

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.

Implementors§

§

impl<'a, T> Destructure for &'a Cell<T>
where T: ?Sized,

§

impl<'a, T> Destructure for &'a ManuallyDrop<T>
where T: ?Sized,

§

impl<'a, T> Destructure for &'a UnsafeCell<T>
where T: ?Sized,

§

impl<'a, T> Destructure for &'a MaybeUninit<T>

§

impl<'a, T> Destructure for &'a mut Cell<T>
where T: ?Sized,

§

impl<'a, T> Destructure for &'a mut ManuallyDrop<T>
where T: ?Sized,

§

impl<'a, T> Destructure for &'a mut UnsafeCell<T>
where T: ?Sized,

§

impl<'a, T> Destructure for &'a mut MaybeUninit<T>

§

impl<T> Destructure for Cell<T>

§

impl<T> Destructure for ManuallyDrop<T>

§

impl<T> Destructure for UnsafeCell<T>

§

impl<T> Destructure for Seal<'_, T>
where T: ?Sized,

§

impl<T> Destructure for Place<T>
where T: ?Sized,

§

impl<T> Destructure for MaybeUninit<T>