pub struct Integer(/* private fields */);
Expand description
An integer type that can safely convert between other number types using compile-time evaluation.
Implementations§
§impl Integer
impl Integer
pub const fn as_i8(&self) -> Result<i8, Error>
pub const fn as_i8(&self) -> Result<i8, Error>
Returns the contained value as an i8, or an error if the value is unable to fit.
pub const fn as_u8(&self) -> Result<u8, Error>
pub const fn as_u8(&self) -> Result<u8, Error>
Returns the contained value as an u8, or an error if the value is unable to fit.
pub const fn as_i16(&self) -> Result<i16, Error>
pub const fn as_i16(&self) -> Result<i16, Error>
Returns the contained value as an i16, or an error if the value is unable to fit.
pub const fn as_u16(&self) -> Result<u16, Error>
pub const fn as_u16(&self) -> Result<u16, Error>
Returns the contained value as an u16, or an error if the value is unable to fit.
pub const fn as_i32(&self) -> Result<i32, Error>
pub const fn as_i32(&self) -> Result<i32, Error>
Returns the contained value as an i32, or an error if the value is unable to fit.
pub const fn as_u32(&self) -> Result<u32, Error>
pub const fn as_u32(&self) -> Result<u32, Error>
Returns the contained value as an u32, or an error if the value is unable to fit.
pub const fn as_i64(&self) -> Result<i64, Error>
pub const fn as_i64(&self) -> Result<i64, Error>
Returns the contained value as an i64, or an error if the value is unable to fit.
pub const fn as_i128(&self) -> Result<i128, Error>
pub const fn as_i128(&self) -> Result<i128, Error>
Returns the contained value as an i64, or an error if the value is unable to fit.
pub const fn as_u64(&self) -> Result<u64, Error>
pub const fn as_u64(&self) -> Result<u64, Error>
Returns the contained value as an u64, or an error if the value is unable to fit.
pub const fn as_u128(&self) -> Result<u128, Error>
pub const fn as_u128(&self) -> Result<u128, Error>
Returns the contained value as an u64, or an error if the value is unable to fit.
pub fn write_to<W>(&self, writer: W) -> Result<usize, Error>where
W: WriteBytesExt,
pub fn write_to<W>(&self, writer: W) -> Result<usize, Error>where
W: WriteBytesExt,
Writes this value using the smallest form possible.
pub fn read_from<R>(
kind: Kind,
byte_len: usize,
reader: &mut R
) -> Result<Integer, Error>where
R: ReadBytesExt,
pub fn read_from<R>(
kind: Kind,
byte_len: usize,
reader: &mut R
) -> Result<Integer, Error>where
R: ReadBytesExt,
Reads an integer based on the atom header (kind
and byte_len
).
byte_len
should be the argument from the atom header directly.
pub fn as_f32(&self) -> Result<f32, Error>
pub fn as_f32(&self) -> Result<f32, Error>
Converts this integer to an f32, but only if it can be done without losing precision.
Trait Implementations§
impl Copy for Integer
impl Eq for Integer
impl StructuralEq for Integer
impl StructuralPartialEq for Integer
Auto Trait Implementations§
impl RefUnwindSafe for Integer
impl Send for Integer
impl Sync for Integer
impl Unpin for Integer
impl UnwindSafe for Integer
Blanket Implementations§
§impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
§impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
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
§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key
and return true
if they are equal.