Struct cardano_serialization_lib::utils::Int
source · [−]pub struct Int(_);
Implementations
sourceimpl Int
impl Int
pub fn from_bytes(bytes: Vec<u8>) -> Result<Int, DeserializeError>
sourceimpl Int
impl Int
pub fn new(x: &BigNum) -> Self
pub fn new_negative(x: &BigNum) -> Self
pub fn new_i32(x: i32) -> Self
pub fn is_positive(&self) -> bool
sourcepub fn as_positive(&self) -> Option<BigNum>
pub fn as_positive(&self) -> Option<BigNum>
BigNum can only contain unsigned u64 values
This function will return the BigNum representation only in case the underlying i128 value is positive.
Otherwise nothing will be returned (undefined).
sourcepub fn as_negative(&self) -> Option<BigNum>
pub fn as_negative(&self) -> Option<BigNum>
BigNum can only contain unsigned u64 values
This function will return the absolute BigNum representation only in case the underlying i128 value is negative.
Otherwise nothing will be returned (undefined).
sourcepub fn as_i32(&self) -> Option<i32>
👎 Deprecated since 10.0.0: Unsafe ignoring of possible boundary error and it’s not clear from the function name. Use as_i32_or_nothing
, as_i32_or_fail
, or to_str
pub fn as_i32(&self) -> Option<i32>
Unsafe ignoring of possible boundary error and it’s not clear from the function name. Use as_i32_or_nothing
, as_i32_or_fail
, or to_str
!!! DEPRECATED !!! Returns an i32 value in case the underlying original i128 value is within the limits. Otherwise will just return an empty value (undefined).
sourcepub fn as_i32_or_nothing(&self) -> Option<i32>
pub fn as_i32_or_nothing(&self) -> Option<i32>
Returns the underlying value converted to i32 if possible (within limits) Otherwise will just return an empty value (undefined).
sourcepub fn as_i32_or_fail(&self) -> Result<i32, JsError>
pub fn as_i32_or_fail(&self) -> Result<i32, JsError>
Returns the underlying value converted to i32 if possible (within limits) JsError in case of out of boundary overflow
Trait Implementations
sourceimpl Deserialize for Int
impl Deserialize for Int
fn deserialize<R: BufRead + Seek>(
raw: &mut Deserializer<R>
) -> Result<Self, DeserializeError>
sourceimpl Ord for Int
impl Ord for Int
sourceimpl PartialOrd<Int> for Int
impl PartialOrd<Int> for Int
sourcefn partial_cmp(&self, other: &Int) -> Option<Ordering>
fn partial_cmp(&self, other: &Int) -> Option<Ordering>
This method returns an ordering between self
and other
values if one exists. Read more
1.0.0 · sourcefn lt(&self, other: &Rhs) -> bool
fn lt(&self, other: &Rhs) -> bool
This method tests less than (for self
and other
) and is used by the <
operator. Read more
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 more
sourceimpl Serialize for Int
impl Serialize for Int
fn serialize<'se, W: Write>(
&self,
serializer: &'se mut Serializer<W>
) -> Result<&'se mut Serializer<W>>
impl Eq for Int
impl StructuralEq for Int
impl StructuralPartialEq for Int
Auto Trait Implementations
impl RefUnwindSafe for Int
impl Send for Int
impl Sync for Int
impl Unpin for Int
impl UnwindSafe for Int
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
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