#[repr(C, align(16))]pub struct Align16U128(pub u128);
Expand description
A thin wrapper around u128 that ensures 16-byte alignment.
Since wasm is happy with 8-byte aligned u128
, a u128
value
would sometimes get placed into an 8-byte aligned memory address
by Rust when created in wasm-land, but this breaks memory safety requirements
if we want to access that value directly on the host side and triggering a relevant
assertion in safe casting functions. As a result,
in ffi types, this should always be used over a raw u128
Tuple Fields§
§0: u128
Trait Implementations§
Source§impl AsMut<u128> for Align16U128
impl AsMut<u128> for Align16U128
Source§impl AsRef<u128> for Align16U128
impl AsRef<u128> for Align16U128
Source§impl Clone for Align16U128
impl Clone for Align16U128
Source§fn clone(&self) -> Align16U128
fn clone(&self) -> Align16U128
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source
. Read moreSource§impl Debug for Align16U128
impl Debug for Align16U128
Source§impl Default for Align16U128
impl Default for Align16U128
Source§fn default() -> Align16U128
fn default() -> Align16U128
Returns the “default value” for a type. Read more
Source§impl Deref for Align16U128
impl Deref for Align16U128
Source§impl DerefMut for Align16U128
impl DerefMut for Align16U128
Source§impl Display for Align16U128
impl Display for Align16U128
Source§impl From<Align16U128> for u128
impl From<Align16U128> for u128
Source§fn from(value: Align16U128) -> Self
fn from(value: Align16U128) -> Self
Converts to this type from the input type.
Source§impl From<u128> for Align16U128
impl From<u128> for Align16U128
impl Copy for Align16U128
impl Pod for Align16U128
Auto Trait Implementations§
impl Freeze for Align16U128
impl RefUnwindSafe for Align16U128
impl Send for Align16U128
impl Sync for Align16U128
impl Unpin for Align16U128
impl UnwindSafe for Align16U128
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
Mutably borrows from an owned value. Read more
Source§impl<T> CheckedBitPattern for Twhere
T: AnyBitPattern,
impl<T> CheckedBitPattern for Twhere
T: AnyBitPattern,
Source§type Bits = T
type Bits = T
Self
must have the same layout as the specified Bits
except for
the possible invalid bit patterns being checked during
is_valid_bit_pattern
.Source§fn is_valid_bit_pattern(_bits: &T) -> bool
fn is_valid_bit_pattern(_bits: &T) -> bool
If this function returns true, then it must be valid to reinterpret
bits
as &Self
.