Skip to main content

Wrap

Struct Wrap 

Source
pub struct Wrap<Src, Dst>(pub Src, pub PhantomData<Dst>);

Tuple Fields§

§0: Src§1: PhantomData<Dst>

Implementations§

Source§

impl<Src, Dst> Wrap<Src, Dst>

Source

pub const fn new(src: Src) -> Self

Source§

impl<'a, Src, Dst> Wrap<&'a Src, &'a Dst>
where Src: ?Sized, Dst: ?Sized,

Source§

impl<'a, Src, Dst> Wrap<&'a Src, &'a Dst>

Source

pub const unsafe fn transmute_ref(self) -> &'a Dst

§Safety

The caller must guarantee that:

  • Src: IntoBytes + Immutable
  • Dst: FromBytes + Immutable
§PME

Instantiating this method PMEs unless both:

  • mem::size_of::<Dst>() == mem::size_of::<Src>()
  • mem::align_of::<Dst>() <= mem::align_of::<Src>()
Source

pub fn try_transmute_ref(self) -> Result<&'a Dst, ValidityError<&'a Src, Dst>>

Source§

impl<'a, Src, Dst> Wrap<&'a mut Src, &'a mut Dst>
where Src: ?Sized, Dst: ?Sized,

Source§

impl<'a, Src, Dst> Wrap<&'a mut Src, &'a mut Dst>

Source

pub fn transmute_mut(self) -> &'a mut Dst
where Src: FromBytes + IntoBytes, Dst: FromBytes + IntoBytes,

Transmutes a mutable reference of one type to a mutable reference of another type.

§PME

Instantiating this method PMEs unless both:

  • mem::size_of::<Dst>() == mem::size_of::<Src>()
  • mem::align_of::<Dst>() <= mem::align_of::<Src>()
Source

pub fn try_transmute_mut( self, ) -> Result<&'a mut Dst, ValidityError<&'a mut Src, Dst>>

Trait Implementations§

Source§

impl<Src: Clone, Dst: Clone> Clone for Wrap<Src, Dst>

Source§

fn clone(&self) -> Wrap<Src, Dst>

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl<'a, Src, Dst> TransmuteMutDst<'a> for Wrap<&'a mut Src, &'a mut Dst>
where Src: KnownLayout + FromBytes + IntoBytes + ?Sized, Dst: KnownLayout<PointerMetadata = usize> + FromBytes + IntoBytes + ?Sized,

Source§

impl<'a, Src, Dst> TransmuteRefDst<'a> for Wrap<&'a Src, &'a Dst>
where Src: KnownLayout + IntoBytes + Immutable + ?Sized, Dst: KnownLayout<PointerMetadata = usize> + FromBytes + Immutable + ?Sized,

Source§

impl<'a, Src, Dst> TryTransmuteMutDst<'a> for Wrap<&'a mut Src, &'a mut Dst>

Source§

type Dst = Dst

Source§

fn try_transmute_mut( self, ) -> Result<&'a mut Dst, ValidityError<&'a mut <Wrap<&'a mut Src, &'a mut Dst> as TryTransmuteMutSrc<'a>>::Src, Dst>>

See try_transmute_mut! documentation.
Source§

impl<'a, Src, Dst> TryTransmuteMutSrc<'a> for Wrap<&'a mut Src, &'a mut Dst>
where Src: ?Sized, Dst: ?Sized,

Source§

type Src = Src

Source§

impl<'a, Src, Dst> TryTransmuteRefDst<'a> for Wrap<&'a Src, &'a Dst>

Source§

type Dst = Dst

Source§

fn try_transmute_ref( self, ) -> Result<&'a Dst, ValidityError<&'a <Wrap<&'a Src, &'a Dst> as TryTransmuteRefSrc<'a>>::Src, Dst>>

See try_transmute_ref! documentation.
Source§

impl<'a, Src, Dst> TryTransmuteRefSrc<'a> for Wrap<&'a Src, &'a Dst>
where Src: ?Sized, Dst: ?Sized,

Source§

type Src = Src

Source§

impl<Src: Copy, Dst: Copy> Copy for Wrap<Src, Dst>

Auto Trait Implementations§

§

impl<Src, Dst> Freeze for Wrap<Src, Dst>
where Src: Freeze,

§

impl<Src, Dst> RefUnwindSafe for Wrap<Src, Dst>
where Src: RefUnwindSafe, Dst: RefUnwindSafe,

§

impl<Src, Dst> Send for Wrap<Src, Dst>
where Src: Send, Dst: Send,

§

impl<Src, Dst> Sync for Wrap<Src, Dst>
where Src: Sync, Dst: Sync,

§

impl<Src, Dst> Unpin for Wrap<Src, Dst>
where Src: Unpin, Dst: Unpin,

§

impl<Src, Dst> UnsafeUnpin for Wrap<Src, Dst>
where Src: UnsafeUnpin,

§

impl<Src, Dst> UnwindSafe for Wrap<Src, Dst>
where Src: UnwindSafe, Dst: UnwindSafe,

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> SizeEq<Cell<T>> for T
where T: ?Sized,

Source§

type CastFrom = CastFromWrapper

Source§

impl<T> SizeEq<ManuallyDrop<T>> for T
where T: ?Sized,

Source§

type CastFrom = CastFromWrapper

Source§

impl<T> SizeEq<MaybeUninit<T>> for T

Source§

impl<T> SizeEq<T> for T
where T: ?Sized,

Source§

impl<T> SizeEq<UnsafeCell<T>> for T
where T: ?Sized,

Source§

type CastFrom = CastFromWrapper

Source§

impl<T> SizeEq<Wrapping<T>> for T

Source§

type CastFrom = CastFromWrapper

Source§

impl<T> SizedTypeProperties for T

Source§

#[doc(hidden)]
const SIZE: usize = _

🔬This is a nightly-only experimental API. (sized_type_properties)
Source§

#[doc(hidden)]
const ALIGN: usize = _

🔬This is a nightly-only experimental API. (sized_type_properties)
Source§

#[doc(hidden)]
const ALIGNMENT: Alignment = _

🔬This is a nightly-only experimental API. (ptr_alignment_type)
Source§

#[doc(hidden)]
const IS_ZST: bool = _

🔬This is a nightly-only experimental API. (sized_type_properties)
true if this type requires no storage. false if its size is greater than zero. Read more
Source§

#[doc(hidden)]
const LAYOUT: Layout = _

🔬This is a nightly-only experimental API. (sized_type_properties)
Source§

#[doc(hidden)]
const MAX_SLICE_LEN: usize = _

🔬This is a nightly-only experimental API. (sized_type_properties)
The largest safe length for a [Self]. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<T> InvariantsEq<ManuallyDrop<T>> for T
where T: ?Sized,

Source§

impl<T> InvariantsEq<T> for T
where T: ?Sized,

Source§

impl<T> InvariantsEq<Wrapping<T>> for T

Source§

impl<Src, Dst, A, SV, DV, R> MutationCompatible<Src, A, SV, DV, (BecauseRead, R)> for Dst
where A: Aliasing, SV: Validity, DV: Validity, Src: Read<A, R> + ?Sized, Dst: Read<A, R> + ?Sized,

Source§

impl<Src, Dst, A, SV, DV> MutationCompatible<Src, A, SV, DV, BecauseInvariantsEq> for Dst
where A: Aliasing, SV: Validity, DV: Validity, Src: TransmuteFrom<Dst, DV, SV> + ?Sized, Dst: TransmuteFrom<Src, SV, DV> + InvariantsEq<Src> + ?Sized,

Source§

impl<T> Read<Exclusive, BecauseExclusive> for T
where T: ?Sized,

Source§

impl<T> TransmuteFrom<Cell<T>, Valid, Valid> for T
where T: ?Sized,

Source§

impl<T> TransmuteFrom<ManuallyDrop<T>, Valid, Valid> for T
where T: ?Sized,

Source§

impl<Src, Dst> TransmuteFrom<Src, Initialized, Initialized> for Dst
where Src: ?Sized, Dst: ?Sized,

Source§

impl<Src, Dst, V> TransmuteFrom<Src, V, Uninit> for Dst
where V: Validity, Src: ?Sized, Dst: ?Sized,

Source§

impl<Src, Dst> TransmuteFrom<Src, Valid, Initialized> for Dst
where Src: IntoBytes + ?Sized, Dst: ?Sized,

Source§

impl<T> TransmuteFrom<UnsafeCell<T>, Valid, Valid> for T
where T: ?Sized,

Source§

impl<T> TransmuteFrom<Wrapping<T>, Valid, Valid> for T

Source§

impl<Src, Dst, A, SV, DV, C, R> TransmuteFromPtr<Src, A, SV, DV, C, R> for Dst
where A: Aliasing, SV: Validity, DV: Validity, C: CastExact<Src, Dst>, Dst: TransmuteFrom<Src, SV, DV> + TryTransmuteFromPtr<Src, A, SV, DV, C, R> + ?Sized, Src: ?Sized,

Source§

impl<Src, Dst, SV, DV, A, C, R> TryTransmuteFromPtr<Src, A, SV, DV, C, (BecauseMutationCompatible, R)> for Dst
where A: Aliasing, SV: Validity, DV: Validity, Src: TransmuteFrom<Dst, DV, SV> + ?Sized, Dst: MutationCompatible<Src, A, SV, DV, R> + ?Sized, C: CastExact<Src, Dst>,