Struct alkahest::FixedIsize
source · #[repr(transparent)]pub struct FixedIsize(_);
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 FixedIsize
impl FixedIsize
sourcepub fn truncate_unchecked(value: isize) -> Self
pub fn truncate_unchecked(value: isize) -> Self
Truncates isize
to FixedIsizeType
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 isize
.
Trait Implementations§
source§impl Clone for FixedIsize
impl Clone for FixedIsize
source§fn clone(&self) -> FixedIsize
fn clone(&self) -> FixedIsize
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 FixedIsize
impl Debug for FixedIsize
source§impl Default for FixedIsize
impl Default for FixedIsize
source§fn default() -> FixedIsize
fn default() -> FixedIsize
Returns the “default value” for a type. Read more
source§impl Deserialize<'_, FixedIsize> for FixedIsize
impl Deserialize<'_, FixedIsize> for FixedIsize
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<'_, FixedIsize> for isize
impl Deserialize<'_, FixedIsize> for isize
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 FixedIsize
impl Formula for FixedIsize
source§impl From<FixedIsize> for FixedIsizeType
impl From<FixedIsize> for FixedIsizeType
source§fn from(value: FixedIsize) -> Self
fn from(value: FixedIsize) -> Self
Converts to this type from the input type.
source§impl From<FixedIsize> for isize
impl From<FixedIsize> for isize
source§fn from(value: FixedIsize) -> Self
fn from(value: FixedIsize) -> Self
Converts to this type from the input type.
source§impl Hash for FixedIsize
impl Hash for FixedIsize
source§impl Ord for FixedIsize
impl Ord for FixedIsize
source§fn cmp(&self, other: &FixedIsize) -> Ordering
fn cmp(&self, other: &FixedIsize) -> 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<FixedIsize> for FixedIsize
impl PartialEq<FixedIsize> for FixedIsize
source§fn eq(&self, other: &FixedIsize) -> bool
fn eq(&self, other: &FixedIsize) -> bool
This method tests for
self
and other
values to be equal, and is used
by ==
.source§impl PartialOrd<FixedIsize> for FixedIsize
impl PartialOrd<FixedIsize> for FixedIsize
source§fn partial_cmp(&self, other: &FixedIsize) -> Option<Ordering>
fn partial_cmp(&self, other: &FixedIsize) -> 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<FixedIsize> for &FixedIsize
impl Serialize<FixedIsize> for &FixedIsize
source§impl Serialize<FixedIsize> for &isize
impl Serialize<FixedIsize> for &isize
source§impl Serialize<FixedIsize> for FixedIsize
impl Serialize<FixedIsize> for FixedIsize
source§impl Serialize<FixedIsize> for isize
impl Serialize<FixedIsize> for isize
source§impl TryFrom<i32> for FixedIsize
impl TryFrom<i32> for FixedIsize
§type Error = TryFromIntError
type Error = TryFromIntError
The type returned in the event of a conversion error.
source§fn try_from(value: FixedIsizeType) -> Result<Self, TryFromIntError>
fn try_from(value: FixedIsizeType) -> Result<Self, TryFromIntError>
Performs the conversion.
source§impl TryFrom<isize> for FixedIsize
impl TryFrom<isize> for FixedIsize
§type Error = TryFromIntError
type Error = TryFromIntError
The type returned in the event of a conversion error.
impl BareFormula for FixedIsize
impl Copy for FixedIsize
impl Eq for FixedIsize
impl StructuralEq for FixedIsize
impl StructuralPartialEq for FixedIsize
Auto Trait Implementations§
impl RefUnwindSafe for FixedIsize
impl Send for FixedIsize
impl Sync for FixedIsize
impl Unpin for FixedIsize
impl UnwindSafe for FixedIsize
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