pub struct Int(/* private fields */);
Implementations§
Source§impl Int
impl Int
pub fn from_bytes(bytes: Vec<u8>) -> Result<Int, DeserializeError>
Source§impl 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>
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
Sourcepub fn to_str(&self) -> String
pub fn to_str(&self) -> String
Returns string representation of the underlying i128 value directly. Might contain the minus sign (-) in case of negative value.
pub fn from_str(string: &str) -> Result<Int, JsError>
Trait Implementations§
Source§impl<'de> Deserialize<'de> for Int
impl<'de> Deserialize<'de> for Int
Source§fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>where
D: Deserializer<'de>,
fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>where
D: Deserializer<'de>,
Source§impl JsonSchema for Int
impl JsonSchema for Int
Source§fn schema_name() -> String
fn schema_name() -> String
Source§fn json_schema(gen: &mut SchemaGenerator) -> Schema
fn json_schema(gen: &mut SchemaGenerator) -> Schema
Source§fn is_referenceable() -> bool
fn is_referenceable() -> bool
$ref
keyword. Read moreSource§impl Ord for Int
impl Ord for Int
Source§impl PartialOrd for Int
impl PartialOrd for Int
Source§impl 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 StructuralPartialEq for Int
Auto Trait Implementations§
impl Freeze for Int
impl RefUnwindSafe for Int
impl Send for Int
impl Sync for Int
impl Unpin for Int
impl UnwindSafe for Int
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self
into a Left
variant of Either<Self, Self>
if into_left
is true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self
into a Left
variant of Either<Self, Self>
if into_left(&self)
returns true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read more