Struct alkahest::FixedUsize
source · #[repr(transparent)]pub struct FixedUsize(_);Expand description
Type used to represent usize in serialized form.
Used for serialization of sizes and offsets. This places limitation on sequence sizes and data sizes that can be serialized.
Number of bits is controlled by "fixed*" feature flags.
Default is "fixed32" - fixed sizes are 32-bit integers.
Implementations§
source§impl FixedUsize
impl FixedUsize
sourcepub fn truncate_unchecked(value: usize) -> Self
pub fn truncate_unchecked(value: usize) -> Self
Truncates usize to FixedUsizeType without checking.
sourcepub fn to_le_bytes(self) -> [u8; 4]
pub fn to_le_bytes(self) -> [u8; 4]
Converts to byte array in little endian.
sourcepub fn from_le_bytes(bytes: [u8; 4]) -> Result<Self, TryFromIntError>
pub fn from_le_bytes(bytes: [u8; 4]) -> Result<Self, TryFromIntError>
Converts from byte array in little endian.
Errors
Returns Err if the byte array does not represent a valid usize.
Trait Implementations§
source§impl Clone for FixedUsize
impl Clone for FixedUsize
source§fn clone(&self) -> FixedUsize
fn clone(&self) -> FixedUsize
Returns a copy 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 FixedUsize
impl Debug for FixedUsize
source§impl Default for FixedUsize
impl Default for FixedUsize
source§fn default() -> FixedUsize
fn default() -> FixedUsize
Returns the “default value” for a type. Read more
source§impl Deserialize<'_, FixedUsize> for FixedUsize
impl Deserialize<'_, FixedUsize> for FixedUsize
source§fn deserialize(de: Deserializer<'_>) -> Result<Self, DeserializeError>
fn deserialize(de: Deserializer<'_>) -> Result<Self, DeserializeError>
Deserializes value provided deserializer.
Returns deserialized value and the number of bytes consumed from
the and of input. Read more
source§fn deserialize_in_place(
&mut self,
de: Deserializer<'_>
) -> Result<(), DeserializeError>
fn deserialize_in_place( &mut self, de: Deserializer<'_> ) -> Result<(), DeserializeError>
Deserializes value in-place provided deserializer.
Overwrites
self with data from the input. Read moresource§impl Deserialize<'_, FixedUsize> for usize
impl Deserialize<'_, FixedUsize> for usize
source§fn deserialize(de: Deserializer<'_>) -> Result<Self, DeserializeError>
fn deserialize(de: Deserializer<'_>) -> Result<Self, DeserializeError>
Deserializes value provided deserializer.
Returns deserialized value and the number of bytes consumed from
the and of input. Read more
source§fn deserialize_in_place(
&mut self,
de: Deserializer<'_>
) -> Result<(), DeserializeError>
fn deserialize_in_place( &mut self, de: Deserializer<'_> ) -> Result<(), DeserializeError>
Deserializes value in-place provided deserializer.
Overwrites
self with data from the input. Read moresource§impl Formula for FixedUsize
impl Formula for FixedUsize
source§impl From<FixedUsize> for u32
impl From<FixedUsize> for u32
source§fn from(value: FixedUsize) -> Self
fn from(value: FixedUsize) -> Self
Converts to this type from the input type.
source§impl From<FixedUsize> for usize
impl From<FixedUsize> for usize
source§fn from(value: FixedUsize) -> Self
fn from(value: FixedUsize) -> Self
Converts to this type from the input type.
source§impl Hash for FixedUsize
impl Hash for FixedUsize
source§impl Ord for FixedUsize
impl Ord for FixedUsize
source§fn cmp(&self, other: &FixedUsize) -> Ordering
fn cmp(&self, other: &FixedUsize) -> Ordering
1.21.0 · source§fn max(self, other: Self) -> Selfwhere
Self: Sized,
fn max(self, other: Self) -> Selfwhere Self: Sized,
Compares and returns the maximum of two values. Read more
source§impl PartialEq<FixedUsize> for FixedUsize
impl PartialEq<FixedUsize> for FixedUsize
source§fn eq(&self, other: &FixedUsize) -> bool
fn eq(&self, other: &FixedUsize) -> bool
This method tests for
self and other values to be equal, and is used
by ==.source§impl PartialOrd<FixedUsize> for FixedUsize
impl PartialOrd<FixedUsize> for FixedUsize
source§fn partial_cmp(&self, other: &FixedUsize) -> Option<Ordering>
fn partial_cmp(&self, other: &FixedUsize) -> Option<Ordering>
1.0.0 · source§fn le(&self, other: &Rhs) -> bool
fn le(&self, other: &Rhs) -> bool
This method tests less than or equal to (for
self and other) and is used by the <=
operator. Read moresource§impl Serialize<FixedUsize> for &FixedUsize
impl Serialize<FixedUsize> for &FixedUsize
source§impl Serialize<FixedUsize> for &usize
impl Serialize<FixedUsize> for &usize
source§impl Serialize<FixedUsize> for FixedUsize
impl Serialize<FixedUsize> for FixedUsize
source§impl Serialize<FixedUsize> for usize
impl Serialize<FixedUsize> for usize
source§impl TryFrom<u32> for FixedUsize
impl TryFrom<u32> for FixedUsize
§type Error = TryFromIntError
type Error = TryFromIntError
The type returned in the event of a conversion error.
source§impl TryFrom<usize> for FixedUsize
impl TryFrom<usize> for FixedUsize
§type Error = TryFromIntError
type Error = TryFromIntError
The type returned in the event of a conversion error.