pub struct Unaligned<T> { /* private fields */ }Expand description
Force value to be unaligned.
Because all borrows must be properly aligned, this type doesn’t give out
borrows to the inner type. However, if the inner type is Copy then the stored
value can be accessed using Self::into_inner.
Implementations§
Source§impl<T> Unaligned<T>
impl<T> Unaligned<T>
Sourcepub const fn new(value: T) -> Self
pub const fn new(value: T) -> Self
Create new unaligned value.
The returned type will have an alignment of 1 byte.
Sourcepub fn into_inner(self) -> T
pub fn into_inner(self) -> T
Convert into inner value.
The returned value will have it’s normal alignment.
Sourcepub fn as_ptr(&self) -> *const T
pub fn as_ptr(&self) -> *const T
Get unaligned pointer to the inner value.
The returned pointer cannot be made into a borrow or used
with normal pointer functions unless the type T already has
an alignment of 1 byte.
Sourcepub fn as_mut_ptr(&mut self) -> *mut T
pub fn as_mut_ptr(&mut self) -> *mut T
Get unaligned mutable pointer to the inner value.
The returned pointer cannot be made into a borrow or used
with normal pointer functions unless the type T already has
an alignment of 1 byte.
Trait Implementations§
Source§impl<T: VTable> VTable for Unaligned<&T>
impl<T: VTable> VTable for Unaligned<&T>
Source§type Id = <T as VTable>::Id
type Id = <T as VTable>::Id
Source§fn descriptor(&self) -> &Descriptor<Self::Id>
fn descriptor(&self) -> &Descriptor<Self::Id>
Source§fn bound_impl(&self) -> &BoundsImpl<Self::Bounds>
fn bound_impl(&self) -> &BoundsImpl<Self::Bounds>
Source§impl<'a, T: VTable, Bnew: IsBound> VTableSubset<Bnew> for Unaligned<&'a T>where
&'a T: VTableSubset<Bnew>,
<&'a T as VTableSubset<Bnew>>::Subset: Copy,
Unaligned<<&'a T as VTableSubset<Bnew>>::Subset>: VTable<Bounds = Bnew>,
impl<'a, T: VTable, Bnew: IsBound> VTableSubset<Bnew> for Unaligned<&'a T>where
&'a T: VTableSubset<Bnew>,
<&'a T as VTableSubset<Bnew>>::Subset: Copy,
Unaligned<<&'a T as VTableSubset<Bnew>>::Subset>: VTable<Bounds = Bnew>,
impl<T: Copy> Copy for Unaligned<T>
Auto Trait Implementations§
impl<T> Freeze for Unaligned<T>where
T: Freeze,
impl<T> RefUnwindSafe for Unaligned<T>where
T: RefUnwindSafe,
impl<T> Send for Unaligned<T>where
T: Send,
impl<T> Sync for Unaligned<T>where
T: Sync,
impl<T> Unpin for Unaligned<T>where
T: Unpin,
impl<T> UnwindSafe for Unaligned<T>where
T: UnwindSafe,
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Dynamic<Bound<Send, Sync, Copy, Clone, Unpin, __>> for T
impl<T> Dynamic<Bound<Send, Sync, Copy, Clone, Unpin, __>> for T
Source§unsafe fn clone_unchecked(this: &T) -> T
unsafe fn clone_unchecked(this: &T) -> T
Self::clone(). Read moreSource§unsafe fn debug_unchecked(
_this: &T,
_f: &mut Formatter<'_>,
) -> Result<(), Error>
unsafe fn debug_unchecked( _this: &T, _f: &mut Formatter<'_>, ) -> Result<(), Error>
Self::debug(). Read moreSource§impl<T> Dynamic<Bound<Send, Sync, Copy, Clone, __, __>> for T
impl<T> Dynamic<Bound<Send, Sync, Copy, Clone, __, __>> for T
Source§unsafe fn clone_unchecked(this: &T) -> T
unsafe fn clone_unchecked(this: &T) -> T
Self::clone(). Read moreSource§unsafe fn debug_unchecked(
_this: &T,
_f: &mut Formatter<'_>,
) -> Result<(), Error>
unsafe fn debug_unchecked( _this: &T, _f: &mut Formatter<'_>, ) -> Result<(), Error>
Self::debug(). Read moreSource§impl<T> Dynamic<Bound<Send, Sync, Copy, __, Unpin, __>> for T
impl<T> Dynamic<Bound<Send, Sync, Copy, __, Unpin, __>> for T
Source§unsafe fn clone_unchecked(_this: &T) -> T
unsafe fn clone_unchecked(_this: &T) -> T
Self::clone(). Read moreSource§unsafe fn debug_unchecked(
_this: &T,
_f: &mut Formatter<'_>,
) -> Result<(), Error>
unsafe fn debug_unchecked( _this: &T, _f: &mut Formatter<'_>, ) -> Result<(), Error>
Self::debug(). Read moreSource§impl<T> Dynamic<Bound<Send, Sync, Copy, __, __, __>> for T
impl<T> Dynamic<Bound<Send, Sync, Copy, __, __, __>> for T
Source§unsafe fn clone_unchecked(_this: &T) -> T
unsafe fn clone_unchecked(_this: &T) -> T
Self::clone(). Read moreSource§unsafe fn debug_unchecked(
_this: &T,
_f: &mut Formatter<'_>,
) -> Result<(), Error>
unsafe fn debug_unchecked( _this: &T, _f: &mut Formatter<'_>, ) -> Result<(), Error>
Self::debug(). Read moreSource§impl<T> Dynamic<Bound<Send, Sync, __, Clone, Unpin, __>> for T
impl<T> Dynamic<Bound<Send, Sync, __, Clone, Unpin, __>> for T
Source§unsafe fn clone_unchecked(this: &T) -> T
unsafe fn clone_unchecked(this: &T) -> T
Self::clone(). Read moreSource§unsafe fn debug_unchecked(
_this: &T,
_f: &mut Formatter<'_>,
) -> Result<(), Error>
unsafe fn debug_unchecked( _this: &T, _f: &mut Formatter<'_>, ) -> Result<(), Error>
Self::debug(). Read moreSource§impl<T> Dynamic<Bound<Send, Sync, __, Clone, __, __>> for T
impl<T> Dynamic<Bound<Send, Sync, __, Clone, __, __>> for T
Source§unsafe fn clone_unchecked(this: &T) -> T
unsafe fn clone_unchecked(this: &T) -> T
Self::clone(). Read moreSource§unsafe fn debug_unchecked(
_this: &T,
_f: &mut Formatter<'_>,
) -> Result<(), Error>
unsafe fn debug_unchecked( _this: &T, _f: &mut Formatter<'_>, ) -> Result<(), Error>
Self::debug(). Read moreSource§impl<T> Dynamic<Bound<Send, Sync, __, __, Unpin, __>> for T
impl<T> Dynamic<Bound<Send, Sync, __, __, Unpin, __>> for T
Source§unsafe fn clone_unchecked(_this: &T) -> T
unsafe fn clone_unchecked(_this: &T) -> T
Self::clone(). Read moreSource§unsafe fn debug_unchecked(
_this: &T,
_f: &mut Formatter<'_>,
) -> Result<(), Error>
unsafe fn debug_unchecked( _this: &T, _f: &mut Formatter<'_>, ) -> Result<(), Error>
Self::debug(). Read moreSource§impl<T> Dynamic<Bound<Send, Sync, __, __, __, __>> for T
impl<T> Dynamic<Bound<Send, Sync, __, __, __, __>> for T
Source§unsafe fn clone_unchecked(_this: &T) -> T
unsafe fn clone_unchecked(_this: &T) -> T
Self::clone(). Read moreSource§unsafe fn debug_unchecked(
_this: &T,
_f: &mut Formatter<'_>,
) -> Result<(), Error>
unsafe fn debug_unchecked( _this: &T, _f: &mut Formatter<'_>, ) -> Result<(), Error>
Self::debug(). Read moreSource§impl<T> Dynamic<Bound<Send, __, Copy, Clone, Unpin, __>> for T
impl<T> Dynamic<Bound<Send, __, Copy, Clone, Unpin, __>> for T
Source§unsafe fn clone_unchecked(this: &T) -> T
unsafe fn clone_unchecked(this: &T) -> T
Self::clone(). Read moreSource§unsafe fn debug_unchecked(
_this: &T,
_f: &mut Formatter<'_>,
) -> Result<(), Error>
unsafe fn debug_unchecked( _this: &T, _f: &mut Formatter<'_>, ) -> Result<(), Error>
Self::debug(). Read moreSource§impl<T> Dynamic<Bound<Send, __, Copy, Clone, __, __>> for T
impl<T> Dynamic<Bound<Send, __, Copy, Clone, __, __>> for T
Source§unsafe fn clone_unchecked(this: &T) -> T
unsafe fn clone_unchecked(this: &T) -> T
Self::clone(). Read moreSource§unsafe fn debug_unchecked(
_this: &T,
_f: &mut Formatter<'_>,
) -> Result<(), Error>
unsafe fn debug_unchecked( _this: &T, _f: &mut Formatter<'_>, ) -> Result<(), Error>
Self::debug(). Read moreSource§impl<T> Dynamic<Bound<Send, __, Copy, __, Unpin, __>> for T
impl<T> Dynamic<Bound<Send, __, Copy, __, Unpin, __>> for T
Source§unsafe fn clone_unchecked(_this: &T) -> T
unsafe fn clone_unchecked(_this: &T) -> T
Self::clone(). Read moreSource§unsafe fn debug_unchecked(
_this: &T,
_f: &mut Formatter<'_>,
) -> Result<(), Error>
unsafe fn debug_unchecked( _this: &T, _f: &mut Formatter<'_>, ) -> Result<(), Error>
Self::debug(). Read moreSource§impl<T> Dynamic<Bound<Send, __, Copy, __, __, __>> for T
impl<T> Dynamic<Bound<Send, __, Copy, __, __, __>> for T
Source§unsafe fn clone_unchecked(_this: &T) -> T
unsafe fn clone_unchecked(_this: &T) -> T
Self::clone(). Read moreSource§unsafe fn debug_unchecked(
_this: &T,
_f: &mut Formatter<'_>,
) -> Result<(), Error>
unsafe fn debug_unchecked( _this: &T, _f: &mut Formatter<'_>, ) -> Result<(), Error>
Self::debug(). Read moreSource§impl<T> Dynamic<Bound<Send, __, __, Clone, Unpin, __>> for T
impl<T> Dynamic<Bound<Send, __, __, Clone, Unpin, __>> for T
Source§unsafe fn clone_unchecked(this: &T) -> T
unsafe fn clone_unchecked(this: &T) -> T
Self::clone(). Read moreSource§unsafe fn debug_unchecked(
_this: &T,
_f: &mut Formatter<'_>,
) -> Result<(), Error>
unsafe fn debug_unchecked( _this: &T, _f: &mut Formatter<'_>, ) -> Result<(), Error>
Self::debug(). Read moreSource§impl<T> Dynamic<Bound<Send, __, __, Clone, __, __>> for T
impl<T> Dynamic<Bound<Send, __, __, Clone, __, __>> for T
Source§unsafe fn clone_unchecked(this: &T) -> T
unsafe fn clone_unchecked(this: &T) -> T
Self::clone(). Read moreSource§unsafe fn debug_unchecked(
_this: &T,
_f: &mut Formatter<'_>,
) -> Result<(), Error>
unsafe fn debug_unchecked( _this: &T, _f: &mut Formatter<'_>, ) -> Result<(), Error>
Self::debug(). Read moreSource§impl<T> Dynamic<Bound<Send, __, __, __, Unpin, __>> for T
impl<T> Dynamic<Bound<Send, __, __, __, Unpin, __>> for T
Source§unsafe fn clone_unchecked(_this: &T) -> T
unsafe fn clone_unchecked(_this: &T) -> T
Self::clone(). Read moreSource§unsafe fn debug_unchecked(
_this: &T,
_f: &mut Formatter<'_>,
) -> Result<(), Error>
unsafe fn debug_unchecked( _this: &T, _f: &mut Formatter<'_>, ) -> Result<(), Error>
Self::debug(). Read moreSource§impl<T> Dynamic<Bound<Send, __, __, __, __, __>> for Twhere
T: Send,
impl<T> Dynamic<Bound<Send, __, __, __, __, __>> for Twhere
T: Send,
Source§unsafe fn clone_unchecked(_this: &T) -> T
unsafe fn clone_unchecked(_this: &T) -> T
Self::clone(). Read moreSource§unsafe fn debug_unchecked(
_this: &T,
_f: &mut Formatter<'_>,
) -> Result<(), Error>
unsafe fn debug_unchecked( _this: &T, _f: &mut Formatter<'_>, ) -> Result<(), Error>
Self::debug(). Read moreSource§impl<T> Dynamic<Bound<__, Sync, Copy, Clone, Unpin, __>> for T
impl<T> Dynamic<Bound<__, Sync, Copy, Clone, Unpin, __>> for T
Source§unsafe fn clone_unchecked(this: &T) -> T
unsafe fn clone_unchecked(this: &T) -> T
Self::clone(). Read moreSource§unsafe fn debug_unchecked(
_this: &T,
_f: &mut Formatter<'_>,
) -> Result<(), Error>
unsafe fn debug_unchecked( _this: &T, _f: &mut Formatter<'_>, ) -> Result<(), Error>
Self::debug(). Read moreSource§impl<T> Dynamic<Bound<__, Sync, Copy, Clone, __, __>> for T
impl<T> Dynamic<Bound<__, Sync, Copy, Clone, __, __>> for T
Source§unsafe fn clone_unchecked(this: &T) -> T
unsafe fn clone_unchecked(this: &T) -> T
Self::clone(). Read moreSource§unsafe fn debug_unchecked(
_this: &T,
_f: &mut Formatter<'_>,
) -> Result<(), Error>
unsafe fn debug_unchecked( _this: &T, _f: &mut Formatter<'_>, ) -> Result<(), Error>
Self::debug(). Read moreSource§impl<T> Dynamic<Bound<__, Sync, Copy, __, Unpin, __>> for T
impl<T> Dynamic<Bound<__, Sync, Copy, __, Unpin, __>> for T
Source§unsafe fn clone_unchecked(_this: &T) -> T
unsafe fn clone_unchecked(_this: &T) -> T
Self::clone(). Read moreSource§unsafe fn debug_unchecked(
_this: &T,
_f: &mut Formatter<'_>,
) -> Result<(), Error>
unsafe fn debug_unchecked( _this: &T, _f: &mut Formatter<'_>, ) -> Result<(), Error>
Self::debug(). Read moreSource§impl<T> Dynamic<Bound<__, Sync, Copy, __, __, __>> for T
impl<T> Dynamic<Bound<__, Sync, Copy, __, __, __>> for T
Source§unsafe fn clone_unchecked(_this: &T) -> T
unsafe fn clone_unchecked(_this: &T) -> T
Self::clone(). Read moreSource§unsafe fn debug_unchecked(
_this: &T,
_f: &mut Formatter<'_>,
) -> Result<(), Error>
unsafe fn debug_unchecked( _this: &T, _f: &mut Formatter<'_>, ) -> Result<(), Error>
Self::debug(). Read moreSource§impl<T> Dynamic<Bound<__, Sync, __, Clone, Unpin, __>> for T
impl<T> Dynamic<Bound<__, Sync, __, Clone, Unpin, __>> for T
Source§unsafe fn clone_unchecked(this: &T) -> T
unsafe fn clone_unchecked(this: &T) -> T
Self::clone(). Read moreSource§unsafe fn debug_unchecked(
_this: &T,
_f: &mut Formatter<'_>,
) -> Result<(), Error>
unsafe fn debug_unchecked( _this: &T, _f: &mut Formatter<'_>, ) -> Result<(), Error>
Self::debug(). Read moreSource§impl<T> Dynamic<Bound<__, Sync, __, Clone, __, __>> for T
impl<T> Dynamic<Bound<__, Sync, __, Clone, __, __>> for T
Source§unsafe fn clone_unchecked(this: &T) -> T
unsafe fn clone_unchecked(this: &T) -> T
Self::clone(). Read moreSource§unsafe fn debug_unchecked(
_this: &T,
_f: &mut Formatter<'_>,
) -> Result<(), Error>
unsafe fn debug_unchecked( _this: &T, _f: &mut Formatter<'_>, ) -> Result<(), Error>
Self::debug(). Read moreSource§impl<T> Dynamic<Bound<__, Sync, __, __, Unpin, __>> for T
impl<T> Dynamic<Bound<__, Sync, __, __, Unpin, __>> for T
Source§unsafe fn clone_unchecked(_this: &T) -> T
unsafe fn clone_unchecked(_this: &T) -> T
Self::clone(). Read moreSource§unsafe fn debug_unchecked(
_this: &T,
_f: &mut Formatter<'_>,
) -> Result<(), Error>
unsafe fn debug_unchecked( _this: &T, _f: &mut Formatter<'_>, ) -> Result<(), Error>
Self::debug(). Read moreSource§impl<T> Dynamic<Bound<__, Sync, __, __, __, __>> for Twhere
T: Sync,
impl<T> Dynamic<Bound<__, Sync, __, __, __, __>> for Twhere
T: Sync,
Source§unsafe fn clone_unchecked(_this: &T) -> T
unsafe fn clone_unchecked(_this: &T) -> T
Self::clone(). Read moreSource§unsafe fn debug_unchecked(
_this: &T,
_f: &mut Formatter<'_>,
) -> Result<(), Error>
unsafe fn debug_unchecked( _this: &T, _f: &mut Formatter<'_>, ) -> Result<(), Error>
Self::debug(). Read moreSource§impl<T> Dynamic<Bound<__, __, Copy, Clone, Unpin, __>> for T
impl<T> Dynamic<Bound<__, __, Copy, Clone, Unpin, __>> for T
Source§unsafe fn clone_unchecked(this: &T) -> T
unsafe fn clone_unchecked(this: &T) -> T
Self::clone(). Read moreSource§unsafe fn debug_unchecked(
_this: &T,
_f: &mut Formatter<'_>,
) -> Result<(), Error>
unsafe fn debug_unchecked( _this: &T, _f: &mut Formatter<'_>, ) -> Result<(), Error>
Self::debug(). Read moreSource§impl<T> Dynamic<Bound<__, __, Copy, Clone, __, __>> for T
impl<T> Dynamic<Bound<__, __, Copy, Clone, __, __>> for T
Source§unsafe fn clone_unchecked(this: &T) -> T
unsafe fn clone_unchecked(this: &T) -> T
Self::clone(). Read moreSource§unsafe fn debug_unchecked(
_this: &T,
_f: &mut Formatter<'_>,
) -> Result<(), Error>
unsafe fn debug_unchecked( _this: &T, _f: &mut Formatter<'_>, ) -> Result<(), Error>
Self::debug(). Read moreSource§impl<T> Dynamic<Bound<__, __, Copy, __, Unpin, __>> for T
impl<T> Dynamic<Bound<__, __, Copy, __, Unpin, __>> for T
Source§unsafe fn clone_unchecked(_this: &T) -> T
unsafe fn clone_unchecked(_this: &T) -> T
Self::clone(). Read moreSource§unsafe fn debug_unchecked(
_this: &T,
_f: &mut Formatter<'_>,
) -> Result<(), Error>
unsafe fn debug_unchecked( _this: &T, _f: &mut Formatter<'_>, ) -> Result<(), Error>
Self::debug(). Read moreSource§impl<T> Dynamic<Bound<__, __, Copy, __, __, __>> for Twhere
T: Copy,
impl<T> Dynamic<Bound<__, __, Copy, __, __, __>> for Twhere
T: Copy,
Source§unsafe fn clone_unchecked(_this: &T) -> T
unsafe fn clone_unchecked(_this: &T) -> T
Self::clone(). Read moreSource§unsafe fn debug_unchecked(
_this: &T,
_f: &mut Formatter<'_>,
) -> Result<(), Error>
unsafe fn debug_unchecked( _this: &T, _f: &mut Formatter<'_>, ) -> Result<(), Error>
Self::debug(). Read moreSource§impl<T> Dynamic<Bound<__, __, __, Clone, Unpin, __>> for T
impl<T> Dynamic<Bound<__, __, __, Clone, Unpin, __>> for T
Source§unsafe fn clone_unchecked(this: &T) -> T
unsafe fn clone_unchecked(this: &T) -> T
Self::clone(). Read moreSource§unsafe fn debug_unchecked(
_this: &T,
_f: &mut Formatter<'_>,
) -> Result<(), Error>
unsafe fn debug_unchecked( _this: &T, _f: &mut Formatter<'_>, ) -> Result<(), Error>
Self::debug(). Read moreSource§impl<T> Dynamic<Bound<__, __, __, Clone, __, __>> for Twhere
T: Clone,
impl<T> Dynamic<Bound<__, __, __, Clone, __, __>> for Twhere
T: Clone,
Source§unsafe fn clone_unchecked(this: &T) -> T
unsafe fn clone_unchecked(this: &T) -> T
Self::clone(). Read moreSource§unsafe fn debug_unchecked(
_this: &T,
_f: &mut Formatter<'_>,
) -> Result<(), Error>
unsafe fn debug_unchecked( _this: &T, _f: &mut Formatter<'_>, ) -> Result<(), Error>
Self::debug(). Read moreSource§impl<T> Dynamic<Bound<__, __, __, __, Unpin, __>> for Twhere
T: Unpin,
impl<T> Dynamic<Bound<__, __, __, __, Unpin, __>> for Twhere
T: Unpin,
Source§unsafe fn clone_unchecked(_this: &T) -> T
unsafe fn clone_unchecked(_this: &T) -> T
Self::clone(). Read moreSource§unsafe fn debug_unchecked(
_this: &T,
_f: &mut Formatter<'_>,
) -> Result<(), Error>
unsafe fn debug_unchecked( _this: &T, _f: &mut Formatter<'_>, ) -> Result<(), Error>
Self::debug(). Read moreSource§impl<T> Dynamic<Bound<__, __, __, __, __, __>> for T
impl<T> Dynamic<Bound<__, __, __, __, __, __>> for T
Source§unsafe fn clone_unchecked(_this: &T) -> T
unsafe fn clone_unchecked(_this: &T) -> T
Self::clone(). Read moreSource§unsafe fn debug_unchecked(
_this: &T,
_f: &mut Formatter<'_>,
) -> Result<(), Error>
unsafe fn debug_unchecked( _this: &T, _f: &mut Formatter<'_>, ) -> Result<(), Error>
Self::debug(). Read more