Struct zerovec::ule::plain::RawBytesULE
source · #[repr(transparent)]pub struct RawBytesULE<const N: usize>(pub [u8; N]);
Expand description
A u8 array of little-endian data with infallible conversions to and from &u8.
Tuple Fields§
§0: [u8; N]
Implementations§
source§impl<const N: usize> RawBytesULE<N>
impl<const N: usize> RawBytesULE<N>
source§impl RawBytesULE<2>
impl RawBytesULE<2>
sourcepub fn as_unsigned_int(&self) -> u16
pub fn as_unsigned_int(&self) -> u16
Gets this RawBytesULE
as a u16
. This is equivalent to calling AsULE::from_unaligned()
on the appropriately sized type.
sourcepub const fn from_aligned(value: u16) -> Self
pub const fn from_aligned(value: u16) -> Self
Converts a u16
to a RawBytesULE
. This is equivalent to calling AsULE::to_unaligned()
on the appropriately sized type.
source§impl RawBytesULE<4>
impl RawBytesULE<4>
sourcepub fn as_unsigned_int(&self) -> u32
pub fn as_unsigned_int(&self) -> u32
Gets this RawBytesULE
as a u32
. This is equivalent to calling AsULE::from_unaligned()
on the appropriately sized type.
sourcepub const fn from_aligned(value: u32) -> Self
pub const fn from_aligned(value: u32) -> Self
Converts a u32
to a RawBytesULE
. This is equivalent to calling AsULE::to_unaligned()
on the appropriately sized type.
source§impl RawBytesULE<8>
impl RawBytesULE<8>
sourcepub fn as_unsigned_int(&self) -> u64
pub fn as_unsigned_int(&self) -> u64
Gets this RawBytesULE
as a u64
. This is equivalent to calling AsULE::from_unaligned()
on the appropriately sized type.
sourcepub const fn from_aligned(value: u64) -> Self
pub const fn from_aligned(value: u64) -> Self
Converts a u64
to a RawBytesULE
. This is equivalent to calling AsULE::to_unaligned()
on the appropriately sized type.
source§impl RawBytesULE<16>
impl RawBytesULE<16>
sourcepub fn as_unsigned_int(&self) -> u128
pub fn as_unsigned_int(&self) -> u128
Gets this RawBytesULE
as a u128
. This is equivalent to calling AsULE::from_unaligned()
on the appropriately sized type.
sourcepub const fn from_aligned(value: u128) -> Self
pub const fn from_aligned(value: u128) -> Self
Converts a u128
to a RawBytesULE
. This is equivalent to calling AsULE::to_unaligned()
on the appropriately sized type.
source§impl RawBytesULE<2>
impl RawBytesULE<2>
pub const fn from_unsigned(v: u16) -> Self
source§impl RawBytesULE<4>
impl RawBytesULE<4>
pub const fn from_unsigned(v: u32) -> Self
source§impl RawBytesULE<8>
impl RawBytesULE<8>
pub const fn from_unsigned(v: u64) -> Self
source§impl RawBytesULE<16>
impl RawBytesULE<16>
pub const fn from_unsigned(v: u128) -> Self
source§impl RawBytesULE<2>
impl RawBytesULE<2>
pub const fn from_signed(v: i16) -> Self
source§impl RawBytesULE<4>
impl RawBytesULE<4>
pub const fn from_signed(v: i32) -> Self
source§impl RawBytesULE<8>
impl RawBytesULE<8>
pub const fn from_signed(v: i64) -> Self
source§impl RawBytesULE<16>
impl RawBytesULE<16>
pub const fn from_signed(v: i128) -> Self
source§impl RawBytesULE<3>
impl RawBytesULE<3>
sourcepub const fn from_unvalidated_char(uc: UnvalidatedChar) -> Self
pub const fn from_unvalidated_char(uc: UnvalidatedChar) -> Self
Converts a UnvalidatedChar
to its ULE type. This is equivalent to calling
AsULE::to_unaligned
.
Trait Implementations§
source§impl<const N: usize> Clone for RawBytesULE<N>
impl<const N: usize> Clone for RawBytesULE<N>
source§fn clone(&self) -> RawBytesULE<N>
fn clone(&self) -> RawBytesULE<N>
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read moresource§impl<const N: usize> Debug for RawBytesULE<N>
impl<const N: usize> Debug for RawBytesULE<N>
source§impl From<i128> for RawBytesULE<16>
impl From<i128> for RawBytesULE<16>
source§impl From<i16> for RawBytesULE<2>
impl From<i16> for RawBytesULE<2>
source§impl From<i32> for RawBytesULE<4>
impl From<i32> for RawBytesULE<4>
source§impl From<i64> for RawBytesULE<8>
impl From<i64> for RawBytesULE<8>
source§impl From<u128> for RawBytesULE<16>
impl From<u128> for RawBytesULE<16>
source§impl From<u16> for RawBytesULE<2>
impl From<u16> for RawBytesULE<2>
source§impl From<u32> for RawBytesULE<4>
impl From<u32> for RawBytesULE<4>
source§impl From<u64> for RawBytesULE<8>
impl From<u64> for RawBytesULE<8>
source§impl<const N: usize> Hash for RawBytesULE<N>
impl<const N: usize> Hash for RawBytesULE<N>
source§impl<const N: usize> Ord for RawBytesULE<N>
impl<const N: usize> Ord for RawBytesULE<N>
source§fn cmp(&self, other: &RawBytesULE<N>) -> Ordering
fn cmp(&self, other: &RawBytesULE<N>) -> Ordering
1.21.0 · source§fn max(self, other: Self) -> Selfwhere
Self: Sized,
fn max(self, other: Self) -> Selfwhere
Self: Sized,
source§impl<const N: usize> PartialEq for RawBytesULE<N>
impl<const N: usize> PartialEq for RawBytesULE<N>
source§fn eq(&self, other: &RawBytesULE<N>) -> bool
fn eq(&self, other: &RawBytesULE<N>) -> bool
self
and other
values to be equal, and is used
by ==
.source§impl<const N: usize> PartialOrd for RawBytesULE<N>
impl<const N: usize> PartialOrd for RawBytesULE<N>
source§fn partial_cmp(&self, other: &RawBytesULE<N>) -> Option<Ordering>
fn partial_cmp(&self, other: &RawBytesULE<N>) -> Option<Ordering>
1.0.0 · source§fn le(&self, other: &Rhs) -> bool
fn le(&self, other: &Rhs) -> bool
self
and other
) and is used by the <=
operator. Read moresource§impl<const N: usize> ULE for RawBytesULE<N>
impl<const N: usize> ULE for RawBytesULE<N>
source§fn validate_byte_slice(bytes: &[u8]) -> Result<(), ZeroVecError>
fn validate_byte_slice(bytes: &[u8]) -> Result<(), ZeroVecError>
&[u8]
. Read moresource§fn parse_byte_slice(bytes: &[u8]) -> Result<&[Self], ZeroVecError>
fn parse_byte_slice(bytes: &[u8]) -> Result<&[Self], ZeroVecError>
source§unsafe fn from_byte_slice_unchecked(bytes: &[u8]) -> &[Self]
unsafe fn from_byte_slice_unchecked(bytes: &[u8]) -> &[Self]
&[u8]
, and return it as &[Self]
with the same lifetime, assuming
that this byte slice has previously been run through Self::parse_byte_slice()
with
success. Read more