Struct alkahest::FixedUsize
source · #[repr(transparent)]pub struct FixedUsize(_);
Expand description
Type used to represent sizes and offsets in serialized data.
This places limitation on sequence sizes which practically is never hit.
usize
itself is not portable and cannot be written into alkahest package.
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.
impl BareFormula for FixedUsize
impl Copy for FixedUsize
impl Eq for FixedUsize
impl StructuralEq for FixedUsize
impl StructuralPartialEq for FixedUsize
Auto Trait Implementations§
impl RefUnwindSafe for FixedUsize
impl Send for FixedUsize
impl Sync for FixedUsize
impl Unpin for FixedUsize
impl UnwindSafe for FixedUsize
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<'de, F, T> Deserialize<'de, As<F>> for Twhere
F: BareFormula + ?Sized,
T: Deserialize<'de, F>,
impl<'de, F, T> Deserialize<'de, As<F>> for Twhere F: BareFormula + ?Sized, T: Deserialize<'de, F>,
source§fn deserialize(deserializer: Deserializer<'de>) -> Result<T, DeserializeError>
fn deserialize(deserializer: Deserializer<'de>) -> Result<T, 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,
deserializer: Deserializer<'de>
) -> Result<(), DeserializeError>
fn deserialize_in_place( &mut self, deserializer: Deserializer<'de> ) -> Result<(), DeserializeError>
Deserializes value in-place provided deserializer.
Overwrites
self
with data from the input
. Read moresource§impl<'de, F, T> Deserialize<'de, Ref<F>> for Twhere
F: BareFormula + ?Sized,
T: Deserialize<'de, F> + ?Sized,
impl<'de, F, T> Deserialize<'de, Ref<F>> for Twhere F: BareFormula + ?Sized, T: Deserialize<'de, F> + ?Sized,
source§fn deserialize(de: Deserializer<'de>) -> Result<T, DeserializeError>
fn deserialize(de: Deserializer<'de>) -> Result<T, 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<'de>
) -> Result<(), DeserializeError>
fn deserialize_in_place( &mut self, de: Deserializer<'de> ) -> Result<(), DeserializeError>
Deserializes value in-place provided deserializer.
Overwrites
self
with data from the input
. Read more