Struct bert::BertBigInteger
[−]
[src]
pub struct BertBigInteger(pub BigInt);
Methods from Deref<Target = BigInt>
fn to_bytes_le(&self) -> (Sign, Vec<u8>)
Returns the sign and the byte representation of the BigInt
in little-endian byte order.
Examples
use num_bigint::{ToBigInt, Sign}; let i = -1125.to_bigint().unwrap(); assert_eq!(i.to_bytes_le(), (Sign::Minus, vec![101, 4]));
fn to_bytes_be(&self) -> (Sign, Vec<u8>)
Returns the sign and the byte representation of the BigInt
in big-endian byte order.
Examples
use num_bigint::{ToBigInt, Sign}; let i = -1125.to_bigint().unwrap(); assert_eq!(i.to_bytes_be(), (Sign::Minus, vec![4, 101]));
fn to_str_radix(&self, radix: u32) -> String
Returns the integer formatted as a string in the given radix.
radix
must be in the range [2, 36]
.
Examples
use num_bigint::BigInt; let i = BigInt::parse_bytes(b"ff", 16).unwrap(); assert_eq!(i.to_str_radix(16), "ff");
fn sign(&self) -> Sign
Returns the sign of the BigInt
as a Sign
.
Examples
use num_bigint::{ToBigInt, Sign}; assert_eq!(ToBigInt::to_bigint(&1234).unwrap().sign(), Sign::Plus); assert_eq!(ToBigInt::to_bigint(&-4321).unwrap().sign(), Sign::Minus); assert_eq!(ToBigInt::to_bigint(&0).unwrap().sign(), Sign::NoSign);
fn bits(&self) -> usize
Determines the fewest bits necessary to express the BigInt
,
not including the sign.
fn to_biguint(&self) -> Option<BigUint>
Converts this BigInt
into a BigUint
, if it's not negative.
fn checked_add(&self, v: &BigInt) -> Option<BigInt>
fn checked_sub(&self, v: &BigInt) -> Option<BigInt>
fn checked_mul(&self, v: &BigInt) -> Option<BigInt>
fn checked_div(&self, v: &BigInt) -> Option<BigInt>
Trait Implementations
impl Debug for BertBigInteger
[src]
impl PartialEq for BertBigInteger
[src]
fn eq(&self, __arg_0: &BertBigInteger) -> bool
This method tests for self
and other
values to be equal, and is used by ==
. Read more
fn ne(&self, __arg_0: &BertBigInteger) -> bool
This method tests for !=
.
impl Deref for BertBigInteger
[src]
type Target = BigInt
The resulting type after dereferencing
fn deref(&self) -> &Self::Target
The method called to dereference a value
impl Serialize for BertBigInteger
[src]
fn serialize<S>(&self, serializer: &mut S) -> Result<(), S::Error> where
S: Serializer,
S: Serializer,
Serializes this value into this serializer.