Struct primitives::big_num::BigNum
source · pub struct BigNum(_);
Implementations
sourceimpl BigNum
impl BigNum
pub fn new(num: BigUint) -> Result<Self, ParseBigIntError>
pub fn div_floor(&self, other: &Self) -> Self
pub fn to_f64(&self) -> Option<f64>
pub fn to_u64(&self) -> Option<u64>
pub fn to_str_radix(&self, radix: u32) -> String
pub fn from_bytes_be(buf: &[u8]) -> Self
sourcepub fn with_precision(whole_number: u64, with_precision: u8) -> Self
pub fn with_precision(whole_number: u64, with_precision: u8) -> Self
Trait Implementations
sourceimpl AddAssign<&BigNum> for BigNum
impl AddAssign<&BigNum> for BigNum
sourcefn add_assign(&mut self, rhs: &BigNum)
fn add_assign(&mut self, rhs: &BigNum)
Performs the
+=
operation. Read moresourceimpl CheckedSub for BigNum
impl CheckedSub for BigNum
sourcefn checked_sub(&self, v: &Self) -> Option<Self>
fn checked_sub(&self, v: &Self) -> Option<Self>
Subtracts two numbers, checking for underflow. If underflow happens,
None
is returned. Read moresourceimpl<'de> Deserialize<'de> for BigNum
impl<'de> Deserialize<'de> for BigNum
sourcefn 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>,
Deserialize this value from the given Serde deserializer. Read more
sourceimpl<'a> FromSql<'a> for BigNum
impl<'a> FromSql<'a> for BigNum
sourcefn from_sql(
ty: &Type,
raw: &'a [u8]
) -> Result<BigNum, Box<dyn Error + Sync + Send>>
fn from_sql(
ty: &Type,
raw: &'a [u8]
) -> Result<BigNum, Box<dyn Error + Sync + Send>>
Creates a new value of this type from a buffer of data of the specified
Postgres
Type
in its binary format. Read moresourcefn accepts(ty: &Type) -> bool
fn accepts(ty: &Type) -> bool
Determines if a value of this type can be created from the specified
Postgres
Type
. Read moresourceimpl Integer for BigNum
impl Integer for BigNum
sourcefn is_multiple_of(&self, other: &Self) -> bool
fn is_multiple_of(&self, other: &Self) -> bool
sourcefn div_rem(&self, other: &Self) -> (Self, Self)
fn div_rem(&self, other: &Self) -> (Self, Self)
Simultaneous truncated integer division and modulus.
Returns
(quotient, remainder)
. Read moresourcefn gcd_lcm(&self, other: &Self) -> (Self, Self)
fn gcd_lcm(&self, other: &Self) -> (Self, Self)
Greatest Common Divisor (GCD) and
Lowest Common Multiple (LCM) together. Read more
sourcefn extended_gcd(&self, other: &Self) -> ExtendedGcd<Self>where
Self: Clone,
fn extended_gcd(&self, other: &Self) -> ExtendedGcd<Self>where
Self: Clone,
Greatest common divisor and Bézout coefficients. Read more
sourcefn div_mod_floor(&self, other: &Self) -> (Self, Self)
fn div_mod_floor(&self, other: &Self) -> (Self, Self)
Simultaneous floored integer division and modulus.
Returns
(quotient, remainder)
. Read moresourcefn next_multiple_of(&self, other: &Self) -> Selfwhere
Self: Clone,
fn next_multiple_of(&self, other: &Self) -> Selfwhere
Self: Clone,
Rounds up to nearest multiple of argument. Read more
sourcefn prev_multiple_of(&self, other: &Self) -> Selfwhere
Self: Clone,
fn prev_multiple_of(&self, other: &Self) -> Selfwhere
Self: Clone,
Rounds down to nearest multiple of argument. Read more
sourceimpl Num for BigNum
impl Num for BigNum
type FromStrRadixErr = <BigUint as Num>::FromStrRadixErr
sourcefn from_str_radix(s: &str, radix: u32) -> Result<Self, Self::FromStrRadixErr>
fn from_str_radix(s: &str, radix: u32) -> Result<Self, Self::FromStrRadixErr>
Convert from a string and radix (typically
2..=36
). Read moresourceimpl Ord for BigNum
impl Ord for BigNum
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 PartialOrd<BigNum> for BigNum
impl PartialOrd<BigNum> for BigNum
sourcefn partial_cmp(&self, other: &BigNum) -> Option<Ordering>
fn partial_cmp(&self, other: &BigNum) -> 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 moresourceimpl<'a> Sum<&'a UnifiedNum> for BigNum
impl<'a> Sum<&'a UnifiedNum> for BigNum
sourceimpl ToSql for BigNum
impl ToSql for BigNum
sourcefn to_sql(
&self,
ty: &Type,
w: &mut BytesMut
) -> Result<IsNull, Box<dyn Error + Sync + Send>>
fn to_sql(
&self,
ty: &Type,
w: &mut BytesMut
) -> Result<IsNull, Box<dyn Error + Sync + Send>>
Converts the value of
self
into the binary format of the specified
Postgres Type
, appending it to out
. Read moresourcefn accepts(ty: &Type) -> bool
fn accepts(ty: &Type) -> bool
Determines if a value of this type can be converted to the specified
Postgres
Type
. Read moresourcefn to_sql_checked(
&self,
ty: &Type,
out: &mut BytesMut
) -> Result<IsNull, Box<dyn Error + Sync + Send>>
fn to_sql_checked(
&self,
ty: &Type,
out: &mut BytesMut
) -> Result<IsNull, Box<dyn Error + Sync + Send>>
An adaptor method used internally by Rust-Postgres. Read more
sourcefn encode_format(&self, _ty: &Type) -> Format
fn encode_format(&self, _ty: &Type) -> Format
Specify the encode format
impl Eq for BigNum
impl StructuralEq for BigNum
impl StructuralPartialEq for BigNum
Auto Trait Implementations
impl RefUnwindSafe for BigNum
impl Send for BigNum
impl Sync for BigNum
impl Unpin for BigNum
impl UnwindSafe for BigNum
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
sourceimpl<T> BorrowToSql for Twhere
T: ToSql,
impl<T> BorrowToSql for Twhere
T: ToSql,
sourcefn borrow_to_sql(&self) -> &dyn ToSql
fn borrow_to_sql(&self) -> &dyn ToSql
Returns a reference to
self
as a ToSql
trait object.