pub struct IntValue<'a> { /* private fields */ }
Expand description
Represents a signed integer value of any size.
An integer that fits in a u64
or i64
is directly stored in the object.
Anything bigger is stored somewhere else (with lifetime 'a
) as a 2’s complement big-endian
integer in the form of an [u8]
.
Implementations
sourceimpl<'a> IntValue<'a>
impl<'a> IntValue<'a>
pub fn from_bigint(data: &'a [u8]) -> IntValue<'a>
pub fn is_negative(&self) -> bool
sourcepub fn try_into<T: TryFrom<Self>>(self) -> Result<T, ()>
pub fn try_into<T: TryFrom<Self>>(self) -> Result<T, ()>
Convert the value into a primitive integer type, if it fits.
Implemented for u8
, u16
, u32
, u64
, i8
, i16
, i32
and i64
.
If you enable the nightly
feature of this crate, this function is not
available directly: Instead, the std::convert::TryFrom
trait is
implemented for these types.
Trait Implementations
sourceimpl<'a> Ord for IntValue<'a>
impl<'a> Ord for IntValue<'a>
1.21.0 · sourcefn 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
1.21.0 · sourcefn min(self, other: Self) -> Selfwhere
Self: Sized,
fn min(self, other: Self) -> Selfwhere
Self: Sized,
Compares and returns the minimum of two values. Read more
1.50.0 · sourcefn clamp(self, min: Self, max: Self) -> Selfwhere
Self: Sized + PartialOrd<Self>,
fn clamp(self, min: Self, max: Self) -> Selfwhere
Self: Sized + PartialOrd<Self>,
Restrict a value to a certain interval. Read more
sourceimpl<'a> PartialEq<IntValue<'a>> for IntValue<'a>
impl<'a> PartialEq<IntValue<'a>> for IntValue<'a>
sourceimpl<'a> PartialOrd<IntValue<'a>> for IntValue<'a>
impl<'a> PartialOrd<IntValue<'a>> for IntValue<'a>
sourcefn partial_cmp(&self, other: &IntValue<'a>) -> Option<Ordering>
fn partial_cmp(&self, other: &IntValue<'a>) -> Option<Ordering>
1.0.0 · sourcefn 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 moreimpl<'a> Copy for IntValue<'a>
impl<'a> Eq for IntValue<'a>
impl<'a> StructuralEq for IntValue<'a>
impl<'a> StructuralPartialEq for IntValue<'a>
Auto Trait Implementations
impl<'a> RefUnwindSafe for IntValue<'a>
impl<'a> Send for IntValue<'a>
impl<'a> Sync for IntValue<'a>
impl<'a> Unpin for IntValue<'a>
impl<'a> UnwindSafe for IntValue<'a>
Blanket Implementations
sourceimpl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more