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>

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§

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>()

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<PointerMetadata = usize> + 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<PointerMetadata = usize> + IntoBytes + Immutable + ?Sized, Dst: KnownLayout<PointerMetadata = usize> + FromBytes + Immutable + ?Sized,

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> 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> 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 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> Read<Exclusive, BecauseExclusive> for T
where T: ?Sized,