#[repr(C)]pub struct I128<E>(/* private fields */);
Expand description
A type that wraps a byte array to be decoded into a i128
.
The generic parameter represents the endianness used to decode the wrapped value. In
case the value is expected to have fixed endianness, either BigEndian
or
LittleEndian
types should be used, otherwise the Endian
type.
Implementations§
Source§impl<E> I128<E>
impl<E> I128<E>
Sourcepub const fn from_bytes(bytes: [u8; 16]) -> Self
pub const fn from_bytes(bytes: [u8; 16]) -> Self
Converts a byte array into a I128
.
Sourcepub const fn into_bytes(self) -> [u8; 16]
pub const fn into_bytes(self) -> [u8; 16]
Converts a I128
into a byte array.
Source§impl I128<Endian>
impl I128<Endian>
Sourcepub const fn new_with_endian(value: i128, endian: Endian) -> Self
pub const fn new_with_endian(value: i128, endian: Endian) -> Self
Constructs a I128
wrapper type from a i128
value using the specified endianness.
Sourcepub const fn get_with_endian(self, endian: Endian) -> i128
pub const fn get_with_endian(self, endian: Endian) -> i128
Extracts a i128
value from a I128
wrapper using the specified endianness.
Trait Implementations§
Source§impl Debug for I128<LittleEndian>
impl Debug for I128<LittleEndian>
Source§impl<E> ReprByteSlice for I128<E>
impl<E> ReprByteSlice for I128<E>
Source§fn from_byte_slice(s: &[u8]) -> Result<&Self, UnalignedSizeError>
fn from_byte_slice(s: &[u8]) -> Result<&Self, UnalignedSizeError>
Transmutes an immutable byte slice reference into an immutable
Self
reference. Read moreSource§fn from_byte_slice_mut(s: &mut [u8]) -> Result<&mut Self, UnalignedSizeError>
fn from_byte_slice_mut(s: &mut [u8]) -> Result<&mut Self, UnalignedSizeError>
Transmutes a mutable byte slice reference into a mutable
Self
reference. Read moreSource§fn as_byte_slice(&self) -> &[u8]
fn as_byte_slice(&self) -> &[u8]
Transmutes an immutable reference to
self
into an immutable reference to a byte slice.Source§fn as_byte_slice_mut(&mut self) -> &mut [u8]
fn as_byte_slice_mut(&mut self) -> &mut [u8]
Transmutes a mutable reference to
self
into a mutable reference to a byte slice.Source§fn slice_from_byte_slice(s: &[u8]) -> Result<&[Self], UnalignedSizeError>
fn slice_from_byte_slice(s: &[u8]) -> Result<&[Self], UnalignedSizeError>
Transmutes an immutable byte slice reference into an immutable to a slice of
Self
. Read moreSource§fn slice_from_byte_slice_mut(
s: &mut [u8],
) -> Result<&mut [Self], UnalignedSizeError>
fn slice_from_byte_slice_mut( s: &mut [u8], ) -> Result<&mut [Self], UnalignedSizeError>
Transmutes a mutable byte slice reference into a mutable to a slice of
Self
. Read moreSource§fn slice_as_byte_slice(slice: &[Self]) -> Result<&[u8], SliceSizeOverflowError>
fn slice_as_byte_slice(slice: &[Self]) -> Result<&[u8], SliceSizeOverflowError>
Transmutes an immutable reference to a slice of
Self
into an immutable reference to a byte
slice. Read moreSource§fn slice_as_byte_slice_mut(
slice: &mut [Self],
) -> Result<&mut [u8], SliceSizeOverflowError>
fn slice_as_byte_slice_mut( slice: &mut [Self], ) -> Result<&mut [u8], SliceSizeOverflowError>
Transmutes a mutable reference to a slice of
Self
into a mutable reference to a byte
slice. Read moreSource§fn uninit_slice_from_byte_slice(
s: &[MaybeUninit<u8>],
) -> Result<&[MaybeUninit<Self>], UnalignedSizeError>
fn uninit_slice_from_byte_slice( s: &[MaybeUninit<u8>], ) -> Result<&[MaybeUninit<Self>], UnalignedSizeError>
Transmutes an immutable reference to a slice of
MaybeUninit<u8>
into an immutable
reference to a slice of MaybeUninit<Self>
. Read moreSource§fn uninit_slice_from_byte_slice_mut(
s: &mut [MaybeUninit<u8>],
) -> Result<&mut [MaybeUninit<Self>], UnalignedSizeError>
fn uninit_slice_from_byte_slice_mut( s: &mut [MaybeUninit<u8>], ) -> Result<&mut [MaybeUninit<Self>], UnalignedSizeError>
Transmutes a mutable reference to a slice of
MaybeUninit<u8>
into a mutable reference
to a slice of MaybeUninit<Self>
. Read moreSource§fn uninit_slice_as_byte_slice(
slice: &[MaybeUninit<Self>],
) -> Result<&[MaybeUninit<u8>], SliceSizeOverflowError>
fn uninit_slice_as_byte_slice( slice: &[MaybeUninit<Self>], ) -> Result<&[MaybeUninit<u8>], SliceSizeOverflowError>
Transmutes an immutable reference to a slice of
MaybeUninit<Self>
into an immutable
reference to a slice of MaybeUninit<u8>
. Read moreSource§fn uninit_slice_as_byte_slice_mut(
slice: &mut [MaybeUninit<Self>],
) -> Result<&mut [MaybeUninit<u8>], SliceSizeOverflowError>
fn uninit_slice_as_byte_slice_mut( slice: &mut [MaybeUninit<Self>], ) -> Result<&mut [MaybeUninit<u8>], SliceSizeOverflowError>
Transmutes a mutable reference to a slice of
MaybeUninit<u8>
into a mutable reference
to a slice of MaybeUninit<Self>
. Read moreimpl<E: Copy> Copy for I128<E>
impl<E: Eq> Eq for I128<E>
impl<E> StructuralPartialEq for I128<E>
Auto Trait Implementations§
impl<E> Freeze for I128<E>
impl<E> RefUnwindSafe for I128<E>where
E: RefUnwindSafe,
impl<E> Send for I128<E>where
E: Send,
impl<E> Sync for I128<E>where
E: Sync,
impl<E> Unpin for I128<E>where
E: Unpin,
impl<E> UnwindSafe for I128<E>where
E: 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
Mutably borrows from an owned value. Read more