arbi

Struct Arbi

Source
pub struct Arbi { /* private fields */ }
Expand description

Arbitrary Precision Integer type.

§Internal Representation

The internal representation of an Arbi integer consists of a boolean field encoding whether or not the integer is negative, as well as a Vec of Digits (an unsigned integer type) encoding the absolute value of the integer with least significant digits first. A “digit” is a base-Arbi::BASE digit (i.e. an integer in \( [0, \text{Arbi::BASE} - 1] = [0, \text{Digit::MAX}] \)).

§Limits

  • Arbi::MAX_CAPACITY: Vec is limited to isize::MAX bytes in capacity. A digit has size in bytes core::mem::size_of::<Digit>(). The maximum capacity is therefore isize::MAX / core::mem::size_of::<Digit>().
  • Arbi::MAX_BITS: At maximum capacity, Arbi::MAX_BITS bits are available to represent the absolute value of the Arbi integer.

When resizing/reserving more space, if the needed space exceeds isize::MAX in bytes, the Vec allocation methods currently used will panic to signal capacity overflow. The Vec allocation methods also panic if the allocator reports allocation failure. In practice, memory allocation typically fails for less than isize::MAX in bytes.

In the future, we may choose to explicitly handle such errors to avoid a panic, where it makes sense.

§Panic

In general:

  • This crate prefers not to panic, unless for good reason.

  • If an operation can panic, it will be clearly documented.

  • Operations typically only panic because they are enforcing consistency with the behavior of primitive integer types. For example, a division by zero panics. Similarly, Arbi::from_str_radix() and Arbi::to_string_radix() panic if the radix argument value is invalid, consistent with the built-in analogues. Arbi::from_str_base() and Arbi::to_string_base() are equivalent, except that they do not panic on invalid bases.

  • Because Vec is limited to isize::MAX bytes in capacity, if an operation would lead to an Arbi requiring more than isize::MAX bytes in capacity, then the current Vec allocation methods used will panic. The Vec allocation methods also panic if the allocator reports allocation failure. In practice, memory allocation typically fails for less than isize::MAX in bytes.

  • Some operations, such as exponentiation, might know in advance that the result will need a capacity that will exceed Vec’s limits. In such cases, the program will panic immediately, rather than allow it to run a long computation that is guaranteed to exhaust memory.

Implementations§

Source§

impl Arbi

Source

pub fn assign_str_radix( &mut self, s: &str, radix: u32, ) -> Result<(), ParseError>

Assign the integer value the provided string represents to this Arbi integer.

§Panic

Panics if radix is not in \( [2, 36] \). Use Arbi::assign_str_base for a panic-free version.

§Examples
use arbi::{Arbi, ParseError};

let mut x = Arbi::with_capacity(10);
assert_eq!(x, 0);

match x.assign_str_radix("123456789", 10) {
    Ok(_) => assert_eq!(x, 123456789),
    Err(e) => match e {
        ParseError::InvalidDigit => panic!("Found an invalid digit"),
        ParseError::Empty => panic!("Found an empty string"),
    },
}

if let Err(e) = x.assign_str_radix("7c2ecdfacad74e0f0101b", 16) {
    panic!("Parsing error: {}", e);
}
assert_eq!(x, 0x7c2ecdfacad74e0f0101b_u128);

The Arbi integer will remain in its original state if a parsing error occurs:

use arbi::{Arbi, Assign, ParseError};

let mut x = Arbi::from(u128::MAX);
assert_eq!(x, u128::MAX);

match x.assign_str_radix("7c2ecdfacad74e0f0101b", 15) {
    Ok(_) => panic!(),
    Err(e) => {
        assert!(matches!(e, ParseError::InvalidDigit));
        assert_eq!(x, u128::MAX);
    }
}

Panics on invalid radix values

use arbi::Arbi;

let mut x = Arbi::with_capacity(5);
x.assign_str_radix("7c2ecdfacad74e0f0101b", 37);

Example invalid strings

use arbi::{Arbi, ParseError};

let mut a = Arbi::zero();

assert!(matches!(
    a.assign_str_radix("   - ", 10),
    Err(ParseError::Empty)
));
assert!(matches!(
    a.assign_str_radix("ffff", 10),
    Err(ParseError::InvalidDigit)
));
Source

pub fn assign_str_base(&mut self, s: &str, base: Base) -> Result<(), ParseError>

Assign the integer value the provided string represents to this Arbi integer.

§Examples
use arbi::{
    base::{DEC, HEX},
    Arbi, ParseError,
};

let mut x = Arbi::with_capacity(10);
assert_eq!(x, 0);

match x.assign_str_base("123456789", DEC) {
    Ok(_) => assert_eq!(x, 123456789),
    Err(e) => match e {
        ParseError::InvalidDigit => panic!("Found an invalid digit"),
        ParseError::Empty => panic!("Found an empty string"),
    },
}

if let Err(e) = x.assign_str_base("7c2ecdfacad74e0f0101b", HEX) {
    panic!("Parsing error: {}", e);
}
assert_eq!(x, 0x7c2ecdfacad74e0f0101b_u128);

The Arbi integer will remain in its original state if a parsing error occurs:

use arbi::{Arbi, Base, ParseError};

let mut x = Arbi::from(u128::MAX);
assert_eq!(x, u128::MAX);

match x
    .assign_str_base("7c2ecdfacad74e0f0101b", Base::try_from(15).unwrap())
{
    Ok(_) => panic!(),
    Err(e) => {
        assert!(matches!(e, ParseError::InvalidDigit));
        assert_eq!(x, u128::MAX);
    }
}

Example invalid strings:

use arbi::{base::DEC, Arbi, ParseError};

let mut a = Arbi::zero();

assert!(matches!(
    a.assign_str_base("   - ", DEC),
    Err(ParseError::Empty)
));
assert!(matches!(
    a.assign_str_base("ffff", DEC),
    Err(ParseError::InvalidDigit)
));
Source§

impl Arbi

Source

pub fn bit_length(&self) -> BitCount

If nonzero, return the number of bits required to represent its absolute value. Otherwise, return 0.

§Examples
use arbi::Arbi;

let mut a = Arbi::from(u128::MAX);
assert_eq!(a.bit_length(), 128);

a.incr();
assert_eq!(a.bit_length(), 129);
§Complexity

\( O(1) \)

Source§

impl Arbi

Source

pub fn test_bit(&self, i: BitCount) -> bool

Test bit i (zero-based indexing), acting as if the integer is nonnegative.

§Examples
use arbi::Arbi;

// 11000000111001
let a = Arbi::from(12345);
assert_eq!(a.test_bit(0), true);
assert_eq!(a.test_bit(1), false);
assert_eq!(a.test_bit(5), true);
§Complexity

\( O(1) \)

Source

pub fn set_bit(&mut self, i: BitCount) -> &mut Self

Set bit i (zero-based indexing), acting as if the integer is nonnegative, but preserving its original sign in the result.

§Examples
use arbi::Arbi;

// 11000000111001
let mut a = Arbi::from(12345);

a.set_bit(1);
// 11000000111011
assert_eq!(a, 12347);

a.set_bit(14);
// 111000000111011
assert_eq!(a, 28731);
§Complexity
  • \( O(1) \) when setting an existing bit.
  • \( O(n) \) when setting a bit outside the current bit width, as this requires resizing.
Source§

impl Arbi

Source

pub fn count_ones(&self) -> u128

Returns the number of ones in the binary representation of the absolute value of self.

§Examples
use arbi::Arbi;

let a = Arbi::from(0b01001100u32);
assert_eq!(a.count_ones(), 3);

let max_u64 = Arbi::from(u64::MAX);
assert_eq!(max_u64.count_ones(), 64);

let zero = Arbi::zero();
assert_eq!(zero.count_ones(), 0);
§Complexity

\( O(n) \)

Source§

impl Arbi

Source

pub fn leading_ones(&self) -> u128

Returns the number of leading ones in the binary representation of the absolute value of self.

§Examples
use arbi::Arbi;

let zero = Arbi::zero();
assert_eq!(zero.leading_ones(), 0);

let a = Arbi::from(u128::MAX);
assert_eq!(a.leading_ones(), 128);

let b = Arbi::from(u128::MAX - 1);
assert_eq!(b.leading_ones(), 127);
§Complexity

\( O(n) \)

Source§

impl Arbi

Source

pub fn reverse_bits(self) -> Self

Reverses the order of bits in the absolute value of the integer.

The least significant bit becomes the most significant bit, second least significant bit becomes second most-significant bit, etc.

The sign remains unchanged.

§Examples
use arbi::Arbi;

let a = Arbi::from(0x12345678_u32);
let b = a.reverse_bits();

assert_eq!(b, 0x12345678_u32.reverse_bits());
§Complexity

\( O(n) \)

Source§

impl Arbi

Source

pub fn swap_bytes(self) -> Self

Reverses the byte order of the absolute value of the integer.

The sign remains unchanged.

§Examples
use arbi::Arbi;

let a = Arbi::from(0x12345678_u32);
let b = a.swap_bytes();

assert_eq!(b, 0x78563412);
§Complexity

\( O(n) \)

Source§

impl Arbi

Source

pub fn trailing_ones(&self) -> u128

Returns the number of trailing ones in the binary representation of the absolute value of self.

§Examples
use arbi::Arbi;

let zero = Arbi::zero();
assert_eq!(zero.trailing_ones(), 0);

let a = Arbi::from(u128::MAX);
assert_eq!(a.trailing_ones(), 128);

let b = Arbi::from(u128::MAX - 1);
assert_eq!(b.trailing_ones(), 0);
§Complexity

\( O(n) \)

Source§

impl Arbi

Source

pub fn div(&self, other: &Arbi) -> (Arbi, Arbi)

Computes both the quotient and remainder of division of this Arbi object by another Arbi object and returns both the quotient and the remainder as a pair.

In Rust, integer division rounds towards zero and given remainder = dividend % divisor, remainder will have the same sign as the dividend. The behavior of division in this crate is consistent with that of division of integer primitive types.

Generally speaking, division algorithms calculate both the quotient and remainder simultaneously. If you need both, it is best to ask for both in one step rather than use the / and % operators in turn.

§Parameters
  • other: The divisor.
§Panic
Panics if a division by zero attempt is detected, consistent with the built-in behavior of dividing a primitive integer value by zero.
§Return

A pair of Arbi integers where the first element is the quotient and the second element is the remainder.

§Examples
use arbi::{Arbi, Assign};

let num = Arbi::from_str_radix(
    "100000000000000000000000000000000000000000000000000",
    16,
)
.unwrap();
let mut den =
    Arbi::from_str_radix("40000000000000000000000000000000000000", 16)
        .unwrap();

let (quo, rem) = num.div(&den);
assert_eq!(quo, 1125899906842624_u64);
assert_eq!(rem, 0);

if let Err(e) = den.assign_str_radix(
    "-10b67ec03f7d363506c60c8c877b6f92be8f41518c16aa3187",
    16,
) {
    panic!("Parse error: {}", e);
}

let (quo, rem) = num.div(&den);
let expected_rem = Arbi::from_str_radix(
    "54e92bc47a9d2e49a6543c40fc47666d59b2c38caac071917",
    16,
)
.unwrap();
assert_eq!(quo, -15);
assert_eq!(rem, expected_rem);

// We can also use the / and % operators in turn to get the same result,
// but that would involve two passes through the division algorithm.
assert_eq!(&num / &den, -15);
assert_eq!(&num % &den, expected_rem);

Dividing an Arbi integer by zero panics:

use arbi::Arbi;

let x = Arbi::from_str_radix("123456789", 10).unwrap();
let (quo, rem) = x.div(&Arbi::zero());

Dividing a primitive integer value by zero panics:

#![allow(unconditional_panic)]
let zero = 0;
let x = -123456789 / zero;
§Complexity

\( O(m \cdot n) \)

Source§

impl Arbi

Source

pub fn fits<T: Fits<T>>(&self) -> bool

Return true if this Arbi integer fits in the range of the target type.

§Examples
use arbi::{Arbi, Fits};

let mut x = Arbi::from(255);
assert!(x.fits::<u8>());

x.incr();

assert!(!x.fits::<u8>());
Source§

impl Arbi

Source

pub fn from_str_radix(src: &str, radix: u32) -> Result<Self, ParseError>

Equivalent to Arbi::from_str_base(), but panics if the base is invalid (i.e. not in \( [2, 36] \)).

§Examples
use arbi::{Arbi, Base};

let x = Arbi::from_str_radix("987654321", 10).unwrap();
assert_eq!(x, 987654321);
Source

pub fn from_str_base(s: &str, base: Base) -> Result<Self, ParseError>

Construct an integer from a string representing a base-base integer.

Allows leading whitespace and/or a plus/minus sign before the first base-base digit. base must be an integer in \( [2, 36] \). Trailing whitespace is ignored.

§Examples
use arbi::{base::DEC, Arbi};

let x = Arbi::from_str_base("987654321", DEC).unwrap();
assert_eq!(x, 987654321);
Source§

impl Arbi

Source

pub fn incr(&mut self) -> &mut Self

Increment this integer in-place by one.

§Examples
use arbi::Arbi;

let mut x = Arbi::from(987654321);
x.incr();
assert_eq!(x, 987654322);
Source

pub fn decr(&mut self) -> &mut Self

Decrement this integer in-place by one.

§Examples
use arbi::Arbi;

let mut x = Arbi::from(987654321);
x.decr();
assert_eq!(x, 987654320);
Source§

impl Arbi

Source

pub fn to_f64(&self) -> f64

Convert this integer to a floating-point value.

The semantics of this function are consistent with Rust’s built-in behavior for casting from an integer to a float.

§Examples
use arbi::{Arbi, Pow};

let a = Arbi::from(-987654321);
assert_eq!(a.to_f64(), -987654321.0);

let b = Arbi::from(1_u64 << 32);
assert_ne!((&b).pow(31_usize).to_f64(), f64::INFINITY);
assert_eq!((&b).pow(32_usize).to_f64(), f64::INFINITY);
§Complexity

\( O(1) \)

Source§

impl Arbi

Source

pub fn to_i8(&self) -> i8

Convert this Arbi integer to a primitive integer type value.

This is “wrapping”.

§Note
  • From<Arbi> and From<&Arbi> are implemented for each primitive integral type and has the same semantics.
  • In Rust, casting from a larger primitive integer type to a smaller integer type truncates. This function has the same semantics.
§Return

Return the unique value of this target primitive integer type that is congruent to the Arbi integer, modulo \( 2^{N} \), where \( N \) is the width of the target type.

§Examples
use arbi::Arbi;

let x = Arbi::from(i32::MIN);
let y: i32 = x.to_i32();
let z: i16 = x.to_i16();

assert_eq!(y, i32::MIN);
assert_eq!(z, i32::MIN as i16);
assert_eq!(i16::from(&x), i32::MIN as i16);
Source

pub fn to_i8_checked(&self) -> Option<i8>

Convert this Arbi integer to a primitive integer type value.

§Return

Some(value) if the Arbi value fits within the target type’s range, None otherwise.

§Examples
use arbi::Arbi;

let x = Arbi::from(i32::MIN);
let y = x.to_i32_checked();

assert_eq!(y, Some(i32::MIN));

let z = x.to_i16_checked();
assert!(z.is_none());
Source

pub fn fits_i8(&self) -> bool

Return true if this integer fits in this primitive integer type, false otherwise.

§Examples
use arbi::Arbi;

let mut x = Arbi::from(u8::MAX);
assert!(x.fits_u8());

x.incr();

assert!(!x.fits_u8());
Source§

impl Arbi

Source

pub fn to_i16(&self) -> i16

Convert this Arbi integer to a primitive integer type value.

This is “wrapping”.

§Note
  • From<Arbi> and From<&Arbi> are implemented for each primitive integral type and has the same semantics.
  • In Rust, casting from a larger primitive integer type to a smaller integer type truncates. This function has the same semantics.
§Return

Return the unique value of this target primitive integer type that is congruent to the Arbi integer, modulo \( 2^{N} \), where \( N \) is the width of the target type.

§Examples
use arbi::Arbi;

let x = Arbi::from(i32::MIN);
let y: i32 = x.to_i32();
let z: i16 = x.to_i16();

assert_eq!(y, i32::MIN);
assert_eq!(z, i32::MIN as i16);
assert_eq!(i16::from(&x), i32::MIN as i16);
Source

pub fn to_i16_checked(&self) -> Option<i16>

Convert this Arbi integer to a primitive integer type value.

§Return

Some(value) if the Arbi value fits within the target type’s range, None otherwise.

§Examples
use arbi::Arbi;

let x = Arbi::from(i32::MIN);
let y = x.to_i32_checked();

assert_eq!(y, Some(i32::MIN));

let z = x.to_i16_checked();
assert!(z.is_none());
Source

pub fn fits_i16(&self) -> bool

Return true if this integer fits in this primitive integer type, false otherwise.

§Examples
use arbi::Arbi;

let mut x = Arbi::from(u8::MAX);
assert!(x.fits_u8());

x.incr();

assert!(!x.fits_u8());
Source§

impl Arbi

Source

pub fn to_i32(&self) -> i32

Convert this Arbi integer to a primitive integer type value.

This is “wrapping”.

§Note
  • From<Arbi> and From<&Arbi> are implemented for each primitive integral type and has the same semantics.
  • In Rust, casting from a larger primitive integer type to a smaller integer type truncates. This function has the same semantics.
§Return

Return the unique value of this target primitive integer type that is congruent to the Arbi integer, modulo \( 2^{N} \), where \( N \) is the width of the target type.

§Examples
use arbi::Arbi;

let x = Arbi::from(i32::MIN);
let y: i32 = x.to_i32();
let z: i16 = x.to_i16();

assert_eq!(y, i32::MIN);
assert_eq!(z, i32::MIN as i16);
assert_eq!(i16::from(&x), i32::MIN as i16);
Source

pub fn to_i32_checked(&self) -> Option<i32>

Convert this Arbi integer to a primitive integer type value.

§Return

Some(value) if the Arbi value fits within the target type’s range, None otherwise.

§Examples
use arbi::Arbi;

let x = Arbi::from(i32::MIN);
let y = x.to_i32_checked();

assert_eq!(y, Some(i32::MIN));

let z = x.to_i16_checked();
assert!(z.is_none());
Source

pub fn fits_i32(&self) -> bool

Return true if this integer fits in this primitive integer type, false otherwise.

§Examples
use arbi::Arbi;

let mut x = Arbi::from(u8::MAX);
assert!(x.fits_u8());

x.incr();

assert!(!x.fits_u8());
Source§

impl Arbi

Source

pub fn to_i64(&self) -> i64

Convert this Arbi integer to a primitive integer type value.

This is “wrapping”.

§Note
  • From<Arbi> and From<&Arbi> are implemented for each primitive integral type and has the same semantics.
  • In Rust, casting from a larger primitive integer type to a smaller integer type truncates. This function has the same semantics.
§Return

Return the unique value of this target primitive integer type that is congruent to the Arbi integer, modulo \( 2^{N} \), where \( N \) is the width of the target type.

§Examples
use arbi::Arbi;

let x = Arbi::from(i32::MIN);
let y: i32 = x.to_i32();
let z: i16 = x.to_i16();

assert_eq!(y, i32::MIN);
assert_eq!(z, i32::MIN as i16);
assert_eq!(i16::from(&x), i32::MIN as i16);
Source

pub fn to_i64_checked(&self) -> Option<i64>

Convert this Arbi integer to a primitive integer type value.

§Return

Some(value) if the Arbi value fits within the target type’s range, None otherwise.

§Examples
use arbi::Arbi;

let x = Arbi::from(i32::MIN);
let y = x.to_i32_checked();

assert_eq!(y, Some(i32::MIN));

let z = x.to_i16_checked();
assert!(z.is_none());
Source

pub fn fits_i64(&self) -> bool

Return true if this integer fits in this primitive integer type, false otherwise.

§Examples
use arbi::Arbi;

let mut x = Arbi::from(u8::MAX);
assert!(x.fits_u8());

x.incr();

assert!(!x.fits_u8());
Source§

impl Arbi

Source

pub fn to_i128(&self) -> i128

Convert this Arbi integer to a primitive integer type value.

This is “wrapping”.

§Note
  • From<Arbi> and From<&Arbi> are implemented for each primitive integral type and has the same semantics.
  • In Rust, casting from a larger primitive integer type to a smaller integer type truncates. This function has the same semantics.
§Return

Return the unique value of this target primitive integer type that is congruent to the Arbi integer, modulo \( 2^{N} \), where \( N \) is the width of the target type.

§Examples
use arbi::Arbi;

let x = Arbi::from(i32::MIN);
let y: i32 = x.to_i32();
let z: i16 = x.to_i16();

assert_eq!(y, i32::MIN);
assert_eq!(z, i32::MIN as i16);
assert_eq!(i16::from(&x), i32::MIN as i16);
Source

pub fn to_i128_checked(&self) -> Option<i128>

Convert this Arbi integer to a primitive integer type value.

§Return

Some(value) if the Arbi value fits within the target type’s range, None otherwise.

§Examples
use arbi::Arbi;

let x = Arbi::from(i32::MIN);
let y = x.to_i32_checked();

assert_eq!(y, Some(i32::MIN));

let z = x.to_i16_checked();
assert!(z.is_none());
Source

pub fn fits_i128(&self) -> bool

Return true if this integer fits in this primitive integer type, false otherwise.

§Examples
use arbi::Arbi;

let mut x = Arbi::from(u8::MAX);
assert!(x.fits_u8());

x.incr();

assert!(!x.fits_u8());
Source§

impl Arbi

Source

pub fn to_isize(&self) -> isize

Convert this Arbi integer to a primitive integer type value.

This is “wrapping”.

§Note
  • From<Arbi> and From<&Arbi> are implemented for each primitive integral type and has the same semantics.
  • In Rust, casting from a larger primitive integer type to a smaller integer type truncates. This function has the same semantics.
§Return

Return the unique value of this target primitive integer type that is congruent to the Arbi integer, modulo \( 2^{N} \), where \( N \) is the width of the target type.

§Examples
use arbi::Arbi;

let x = Arbi::from(i32::MIN);
let y: i32 = x.to_i32();
let z: i16 = x.to_i16();

assert_eq!(y, i32::MIN);
assert_eq!(z, i32::MIN as i16);
assert_eq!(i16::from(&x), i32::MIN as i16);
Source

pub fn to_isize_checked(&self) -> Option<isize>

Convert this Arbi integer to a primitive integer type value.

§Return

Some(value) if the Arbi value fits within the target type’s range, None otherwise.

§Examples
use arbi::Arbi;

let x = Arbi::from(i32::MIN);
let y = x.to_i32_checked();

assert_eq!(y, Some(i32::MIN));

let z = x.to_i16_checked();
assert!(z.is_none());
Source

pub fn fits_isize(&self) -> bool

Return true if this integer fits in this primitive integer type, false otherwise.

§Examples
use arbi::Arbi;

let mut x = Arbi::from(u8::MAX);
assert!(x.fits_u8());

x.incr();

assert!(!x.fits_u8());
Source§

impl Arbi

Source

pub fn to_u8(&self) -> u8

Convert this Arbi integer to a primitive integer type value.

This is “wrapping”.

§Note
  • From<Arbi> and From<&Arbi> are implemented for each primitive integral type and has the same semantics.
  • In Rust, casting from a larger primitive integer type to a smaller integer type truncates. This function has the same semantics.
§Return

Return the unique value of this target primitive integer type that is congruent to the Arbi integer, modulo \( 2^{N} \), where \( N \) is the width of the target type.

§Examples
use arbi::Arbi;

let x = Arbi::from(i32::MIN);
let y: i32 = x.to_i32();
let z: i16 = x.to_i16();

assert_eq!(y, i32::MIN);
assert_eq!(z, i32::MIN as i16);
assert_eq!(i16::from(&x), i32::MIN as i16);
Source

pub fn to_u8_checked(&self) -> Option<u8>

Convert this Arbi integer to a primitive integer type value.

§Return

Some(value) if the Arbi value fits within the target type’s range, None otherwise.

§Examples
use arbi::Arbi;

let x = Arbi::from(i32::MIN);
let y = x.to_i32_checked();

assert_eq!(y, Some(i32::MIN));

let z = x.to_i16_checked();
assert!(z.is_none());
Source

pub fn fits_u8(&self) -> bool

Return true if this integer fits in this primitive integer type, false otherwise.

§Examples
use arbi::Arbi;

let mut x = Arbi::from(u8::MAX);
assert!(x.fits_u8());

x.incr();

assert!(!x.fits_u8());
Source§

impl Arbi

Source

pub fn to_u16(&self) -> u16

Convert this Arbi integer to a primitive integer type value.

This is “wrapping”.

§Note
  • From<Arbi> and From<&Arbi> are implemented for each primitive integral type and has the same semantics.
  • In Rust, casting from a larger primitive integer type to a smaller integer type truncates. This function has the same semantics.
§Return

Return the unique value of this target primitive integer type that is congruent to the Arbi integer, modulo \( 2^{N} \), where \( N \) is the width of the target type.

§Examples
use arbi::Arbi;

let x = Arbi::from(i32::MIN);
let y: i32 = x.to_i32();
let z: i16 = x.to_i16();

assert_eq!(y, i32::MIN);
assert_eq!(z, i32::MIN as i16);
assert_eq!(i16::from(&x), i32::MIN as i16);
Source

pub fn to_u16_checked(&self) -> Option<u16>

Convert this Arbi integer to a primitive integer type value.

§Return

Some(value) if the Arbi value fits within the target type’s range, None otherwise.

§Examples
use arbi::Arbi;

let x = Arbi::from(i32::MIN);
let y = x.to_i32_checked();

assert_eq!(y, Some(i32::MIN));

let z = x.to_i16_checked();
assert!(z.is_none());
Source

pub fn fits_u16(&self) -> bool

Return true if this integer fits in this primitive integer type, false otherwise.

§Examples
use arbi::Arbi;

let mut x = Arbi::from(u8::MAX);
assert!(x.fits_u8());

x.incr();

assert!(!x.fits_u8());
Source§

impl Arbi

Source

pub fn to_u32(&self) -> u32

Convert this Arbi integer to a primitive integer type value.

This is “wrapping”.

§Note
  • From<Arbi> and From<&Arbi> are implemented for each primitive integral type and has the same semantics.
  • In Rust, casting from a larger primitive integer type to a smaller integer type truncates. This function has the same semantics.
§Return

Return the unique value of this target primitive integer type that is congruent to the Arbi integer, modulo \( 2^{N} \), where \( N \) is the width of the target type.

§Examples
use arbi::Arbi;

let x = Arbi::from(i32::MIN);
let y: i32 = x.to_i32();
let z: i16 = x.to_i16();

assert_eq!(y, i32::MIN);
assert_eq!(z, i32::MIN as i16);
assert_eq!(i16::from(&x), i32::MIN as i16);
Source

pub fn to_u32_checked(&self) -> Option<u32>

Convert this Arbi integer to a primitive integer type value.

§Return

Some(value) if the Arbi value fits within the target type’s range, None otherwise.

§Examples
use arbi::Arbi;

let x = Arbi::from(i32::MIN);
let y = x.to_i32_checked();

assert_eq!(y, Some(i32::MIN));

let z = x.to_i16_checked();
assert!(z.is_none());
Source

pub fn fits_u32(&self) -> bool

Return true if this integer fits in this primitive integer type, false otherwise.

§Examples
use arbi::Arbi;

let mut x = Arbi::from(u8::MAX);
assert!(x.fits_u8());

x.incr();

assert!(!x.fits_u8());
Source§

impl Arbi

Source

pub fn to_u64(&self) -> u64

Convert this Arbi integer to a primitive integer type value.

This is “wrapping”.

§Note
  • From<Arbi> and From<&Arbi> are implemented for each primitive integral type and has the same semantics.
  • In Rust, casting from a larger primitive integer type to a smaller integer type truncates. This function has the same semantics.
§Return

Return the unique value of this target primitive integer type that is congruent to the Arbi integer, modulo \( 2^{N} \), where \( N \) is the width of the target type.

§Examples
use arbi::Arbi;

let x = Arbi::from(i32::MIN);
let y: i32 = x.to_i32();
let z: i16 = x.to_i16();

assert_eq!(y, i32::MIN);
assert_eq!(z, i32::MIN as i16);
assert_eq!(i16::from(&x), i32::MIN as i16);
Source

pub fn to_u64_checked(&self) -> Option<u64>

Convert this Arbi integer to a primitive integer type value.

§Return

Some(value) if the Arbi value fits within the target type’s range, None otherwise.

§Examples
use arbi::Arbi;

let x = Arbi::from(i32::MIN);
let y = x.to_i32_checked();

assert_eq!(y, Some(i32::MIN));

let z = x.to_i16_checked();
assert!(z.is_none());
Source

pub fn fits_u64(&self) -> bool

Return true if this integer fits in this primitive integer type, false otherwise.

§Examples
use arbi::Arbi;

let mut x = Arbi::from(u8::MAX);
assert!(x.fits_u8());

x.incr();

assert!(!x.fits_u8());
Source§

impl Arbi

Source

pub fn to_u128(&self) -> u128

Convert this Arbi integer to a primitive integer type value.

This is “wrapping”.

§Note
  • From<Arbi> and From<&Arbi> are implemented for each primitive integral type and has the same semantics.
  • In Rust, casting from a larger primitive integer type to a smaller integer type truncates. This function has the same semantics.
§Return

Return the unique value of this target primitive integer type that is congruent to the Arbi integer, modulo \( 2^{N} \), where \( N \) is the width of the target type.

§Examples
use arbi::Arbi;

let x = Arbi::from(i32::MIN);
let y: i32 = x.to_i32();
let z: i16 = x.to_i16();

assert_eq!(y, i32::MIN);
assert_eq!(z, i32::MIN as i16);
assert_eq!(i16::from(&x), i32::MIN as i16);
Source

pub fn to_u128_checked(&self) -> Option<u128>

Convert this Arbi integer to a primitive integer type value.

§Return

Some(value) if the Arbi value fits within the target type’s range, None otherwise.

§Examples
use arbi::Arbi;

let x = Arbi::from(i32::MIN);
let y = x.to_i32_checked();

assert_eq!(y, Some(i32::MIN));

let z = x.to_i16_checked();
assert!(z.is_none());
Source

pub fn fits_u128(&self) -> bool

Return true if this integer fits in this primitive integer type, false otherwise.

§Examples
use arbi::Arbi;

let mut x = Arbi::from(u8::MAX);
assert!(x.fits_u8());

x.incr();

assert!(!x.fits_u8());
Source§

impl Arbi

Source

pub fn to_usize(&self) -> usize

Convert this Arbi integer to a primitive integer type value.

This is “wrapping”.

§Note
  • From<Arbi> and From<&Arbi> are implemented for each primitive integral type and has the same semantics.
  • In Rust, casting from a larger primitive integer type to a smaller integer type truncates. This function has the same semantics.
§Return

Return the unique value of this target primitive integer type that is congruent to the Arbi integer, modulo \( 2^{N} \), where \( N \) is the width of the target type.

§Examples
use arbi::Arbi;

let x = Arbi::from(i32::MIN);
let y: i32 = x.to_i32();
let z: i16 = x.to_i16();

assert_eq!(y, i32::MIN);
assert_eq!(z, i32::MIN as i16);
assert_eq!(i16::from(&x), i32::MIN as i16);
Source

pub fn to_usize_checked(&self) -> Option<usize>

Convert this Arbi integer to a primitive integer type value.

§Return

Some(value) if the Arbi value fits within the target type’s range, None otherwise.

§Examples
use arbi::Arbi;

let x = Arbi::from(i32::MIN);
let y = x.to_i32_checked();

assert_eq!(y, Some(i32::MIN));

let z = x.to_i16_checked();
assert!(z.is_none());
Source

pub fn fits_usize(&self) -> bool

Return true if this integer fits in this primitive integer type, false otherwise.

§Examples
use arbi::Arbi;

let mut x = Arbi::from(u8::MAX);
assert!(x.fits_u8());

x.incr();

assert!(!x.fits_u8());
Source§

impl Arbi

Source

pub fn to_string_base(&self, base: Base) -> String

Return a String containing the base-base representation of the integer, where base must be an integer in \( [2, 36] \).

§Examples
use arbi::{Arbi, Base};

let b10 = Base::try_from(10).unwrap();

let a = Arbi::from(123456789);
let s = a.to_string_base(b10);
assert_eq!(s, "123456789");
Source

pub fn to_string_radix(&self, radix: u32) -> String

Equivalent to Arbi::to_string_base(), but panics if the base is invalid (i.e. not in \( [2, 36] \)).

§Examples
use arbi::{Arbi, Base};

let a = Arbi::from(123456789);
let s = a.to_string_radix(10);
assert_eq!(s, "123456789");
Source§

impl Arbi

Source

pub const BASE: u64 = 4_294_967_296u64

Base used for the internal representation of the integer.

Source

pub const MAX_CAPACITY: usize = 536_870_911usize

Maximum capacity for the internal vector of digits.

Vec is limited to isize::MAX bytes in capacity. A digit has size in bytes core::mem::size_of::<Digit>(). The maximum capacity is therefore isize::MAX / core::mem::size_of::<Digit>().

Source

pub const MAX_BITS: BitCount = 17_179_869_152u128

Maximum capacity for the internal vector of digits, in terms of bits.

This represents the number of bits that can be used to represent the absolute value of the integer when the internal digit vector is at maximum capacity.

This is Arbi::MAX_CAPACITY * Digit::BITS.

Source

pub fn new() -> Self

Default constructor. The integer is initialized to zero and no memory allocation occurs.

Note that Arbi::new(), Arbi::zero(), and Arbi::default() are all equivalent.

§Examples
use arbi::Arbi;

let zero = Arbi::new();
assert_eq!(zero, 0);
§Complexity

\( O(1) \)

Source

pub fn zero() -> Self

Equivalent to Arbi::new().

§Examples
use arbi::Arbi;

let zero = Arbi::zero();
assert_eq!(zero, 0);
§Complexity

\( O(1) \)

Source

pub fn with_capacity(capacity: usize) -> Self

Construct a new Arbi integer with at least the specified capacity, in terms of Digits.

The integer’s value will be 0.

§Examples
use arbi::Arbi;

let a = Arbi::with_capacity(10);
assert_eq!(a.capacity(), 10);
assert_eq!(a, 0);

Panics if the new capacity exceeds Arbi::MAX_CAPACITY digits:

use arbi::Arbi;

let a = Arbi::with_capacity(Arbi::MAX_CAPACITY + 1);
§Panic

Panics if the new capacity exceeds isize::MAX bytes (or Arbi::MAX_CAPACITY digits) or if the allocator reports an allocation failure.

Source

pub fn with_capacity_bits(capacity: BitCount) -> Self

Construct a new Arbi integer with at least the specified capacity, in terms of bits.

The integer’s value will be 0.

§Examples
use arbi::{Arbi, BitCount, Digit};

let a = Arbi::with_capacity_bits(Digit::BITS as BitCount - 1);
assert_eq!(a.capacity(), 1);
assert_eq!(a, 0);

let a = Arbi::with_capacity_bits(Digit::BITS as BitCount);
assert_eq!(a.capacity(), 1);

let a = Arbi::with_capacity_bits(Digit::BITS as BitCount + 1);
assert_eq!(a.capacity(), 2);

Panics if the new capacity in bits exceeds Arbi::MAX_BITS bits:

use arbi::Arbi;

// Panics with message: "New capacity exceeds `isize::MAX` bytes".
let a = Arbi::with_capacity_bits(Arbi::MAX_BITS + 1);

Note that, in practice, while the theoretical limit for the capacity of a Vec in bytes is isize::MAX, memory allocation failures typically happen for less.

§Panic

Panics if the new capacity exceeds isize::MAX bytes (or Arbi::MAX_BITS digits) or if the allocator reports an allocation failure.

Source

pub fn capacity(&self) -> usize

Returns the total number of elements the internal digit vector can hold without reallocating.

§Examples
use arbi::{Arbi, Assign};

let zero = Arbi::zero();
assert_eq!(zero.capacity(), 0);

let mut b = Arbi::with_capacity(10);
assert_eq!(b.capacity(), 10);

b.assign(u64::MAX); // no memory allocation needed
assert_eq!(b, u64::MAX);
§Complexity

\( O(1) \)

Source

pub fn capacity_bits(&self) -> BitCount

Return the total number of bits the current capacity can hold to represent the absolute value of this integer.

§Examples
use arbi::{Arbi, BitCount, Digit};

let zero = Arbi::zero();
assert_eq!(zero.capacity_bits(), 0);

let a = Arbi::with_capacity_bits(Digit::BITS as BitCount);
assert!(a.capacity_bits() >= Digit::BITS as BitCount);
§Complexitys

\( O(1) \)

Source

pub fn size(&self) -> usize

Return the number of Digits used to represent the absolute value of this integer.

Instance represents 0 if and only if size() == 0.

§Examples
use arbi::{Arbi, Digit};

let zero = Arbi::zero();
assert_eq!(zero.size(), 0);

let mut a = Arbi::from(Digit::MAX);
assert_eq!(a.size(), 1);

a.incr();
assert_eq!(a.size(), 2);
§Complexity

\( O(1) \)

Source

pub fn size_bits(&self) -> BitCount

Return the number of bits used to represent the absolute value of this integer.

Instance represents 0 if and only if size_bits() == 0.

This is equivalent to Arbi::bit_length().

§Examples
use arbi::{Arbi, BitCount, Digit};

let zero = Arbi::zero();
assert_eq!(zero.size_bits(), 0);

let mut a = Arbi::from(Digit::MAX);
assert_eq!(a.size_bits(), Digit::BITS as BitCount);

a.incr();
assert_eq!(a.size_bits(), Digit::BITS as BitCount + 1);
§Complexity

\( O(1) \)

Source

pub fn is_negative(&self) -> bool

Return true if this Arbi integer is (strictly) negative, false otherwise.

§Examples
use arbi::Arbi;

let neg = Arbi::from(-1234);
let pos = Arbi::from(1234);
let zer = Arbi::zero();

assert!(neg.is_negative());
assert!(!pos.is_negative());
assert!(!zer.is_negative());
§Complexity

\( O(1) \)

Source

pub fn is_odd(&self) -> bool

Return true if this integer is odd, false otherwise.

§Examples
use arbi::Arbi;

let zero = Arbi::zero();
assert!(!zero.is_odd());

let a = Arbi::from(-123456789);
assert!(a.is_odd());

let b = Arbi::from(-12345678);
assert!(!b.is_odd());
§Complexity

\( O(1) \)

Source

pub fn is_even(&self) -> bool

Return true if this integer is even, false otherwise.

§Examples
use arbi::Arbi;

let zero = Arbi::zero();
assert!(zero.is_even());

let a = Arbi::from(-12345678);
assert!(a.is_even());

let b = Arbi::from(-123456789);
assert!(!b.is_even());
§Complexity

\( O(1) \)

Source

pub fn is_zero(&self) -> bool

Return true if this integer is zero, false otherwise.

§Examples
use arbi::Arbi;

let a = Arbi::new();
assert!(a.is_zero());

let b = Arbi::with_capacity(10);
assert!(a.is_zero());

let c = Arbi::with_capacity_bits(100);
assert!(c.is_zero());
§Complexity

\( O(1) \)

Source

pub fn negate(&mut self)

Negates the integer in-place.

§Examples
use arbi::Arbi;

let mut pos = Arbi::from(123456789);

pos.negate();
assert_eq!(pos, -123456789);

pos.negate();
assert_eq!(pos, 123456789);
§Complexity

\( O(1) \)

Source

pub fn abs(&self) -> Arbi

Return a new integer representing the absolute value of this integer.

For in-place negation (\( O(1) \) operation), see Arbi::negate().

§Examples
use arbi::Arbi;

let neg = Arbi::from(-123456789);
let pos = neg.abs();

assert_eq!(pos, 123456789);
§Complexity

\( O(n) \)

Source

pub fn sign(&self) -> Ordering

Return an Ordering indicating the sign of the number: Ordering::Less for negative, Ordering::Equal for zero, Ordering::Greater for positive.

§Examples
use arbi::Arbi;
use core::cmp::Ordering;

let neg = Arbi::from(-123456789);
let zer = Arbi::zero();
let pos = Arbi::from(123456789);

assert_eq!(neg.sign(), Ordering::Less);
assert_eq!(zer.sign(), Ordering::Equal);
assert_eq!(pos.sign(), Ordering::Greater);
§Complexity

\( O(1) \)

Trait Implementations§

Source§

impl<'b> Add<&'b Arbi> for &Arbi

§Complexity

\( O(n) \)

Source§

type Output = Arbi

The resulting type after applying the + operator.
Source§

fn add(self, other: &'b Arbi) -> Arbi

Performs the + operation. Read more
Source§

impl<'a> Add<&'a Arbi> for Arbi

§Complexity

\( O(n) \)

Source§

type Output = Arbi

The resulting type after applying the + operator.
Source§

fn add(self, other: &'a Arbi) -> Self

Performs the + operation. Read more
Source§

impl Add for Arbi

§Complexity

\( O(n) \)

Source§

type Output = Arbi

The resulting type after applying the + operator.
Source§

fn add(self, other: Self) -> Self

Performs the + operation. Read more
Source§

impl<'a> AddAssign<&'a Arbi> for Arbi

§Complexity

\( O(n) \)

Source§

fn add_assign(&mut self, other: &'a Arbi)

Performs the += operation. Read more
Source§

impl AddAssign for Arbi

§Complexity

\( O(n) \)

Source§

fn add_assign(&mut self, other: Self)

Performs the += operation. Read more
Source§

impl Assign<&Arbi> for Arbi

Copies the contents of the argument Arbi integer into this Arbi integer. If this Arbi integer already has enough capacity to represent value, then no memory allocation occurs.

Source§

fn assign(&mut self, value: &Arbi)

Source§

impl Assign<&f64> for Arbi

Source§

fn assign(&mut self, d: &f64)

Assign a floating-point value to an Arbi.

§Panic

Panics when attempting to convert a NaN or infinity.

§Note

In Rust, when casting a primitive float to a primitive integer type, NaNs are converted to 0 and values with large magnitudes and infinities are saturated to the maximum and minimum values of the integer type.

In contrast, this function panics in these scenarios.

Source§

impl Assign<&i128> for Arbi

Source§

fn assign(&mut self, value: &i128)

Assign a builtin integral type value to an Arbi.

Source§

impl Assign<&i16> for Arbi

Source§

fn assign(&mut self, value: &i16)

Assign a builtin integral type value to an Arbi.

Source§

impl Assign<&i32> for Arbi

Source§

fn assign(&mut self, value: &i32)

Assign a builtin integral type value to an Arbi.

Source§

impl Assign<&i64> for Arbi

Source§

fn assign(&mut self, value: &i64)

Assign a builtin integral type value to an Arbi.

Source§

impl Assign<&i8> for Arbi

Source§

fn assign(&mut self, value: &i8)

Assign a builtin integral type value to an Arbi.

Source§

impl Assign<&isize> for Arbi

Source§

fn assign(&mut self, value: &isize)

Assign a builtin integral type value to an Arbi.

Source§

impl Assign<&u128> for Arbi

Source§

fn assign(&mut self, value: &u128)

Assign a builtin integral type value to an Arbi.

Source§

impl Assign<&u16> for Arbi

Source§

fn assign(&mut self, value: &u16)

Assign a builtin integral type value to an Arbi.

Source§

impl Assign<&u32> for Arbi

Source§

fn assign(&mut self, value: &u32)

Assign a builtin integral type value to an Arbi.

Source§

impl Assign<&u64> for Arbi

Source§

fn assign(&mut self, value: &u64)

Assign a builtin integral type value to an Arbi.

Source§

impl Assign<&u8> for Arbi

Source§

fn assign(&mut self, value: &u8)

Assign a builtin integral type value to an Arbi.

Source§

impl Assign<&usize> for Arbi

Source§

fn assign(&mut self, value: &usize)

Assign a builtin integral type value to an Arbi.

Source§

impl Assign<f64> for Arbi

Source§

fn assign(&mut self, d: f64)

Assign a floating-point value to an Arbi.

§Panic

Panics when attempting to convert a NaN or infinity.

§Note

In Rust, when casting a primitive float to a primitive integer type, NaNs are converted to 0 and values with large magnitudes and infinities are saturated to the maximum and minimum values of the integer type.

In contrast, this function panics in these scenarios.

Source§

impl Assign<i128> for Arbi

Source§

fn assign(&mut self, value: i128)

Assign a builtin integral type value to an Arbi.

Source§

impl Assign<i16> for Arbi

Source§

fn assign(&mut self, value: i16)

Assign a builtin integral type value to an Arbi.

Source§

impl Assign<i32> for Arbi

Source§

fn assign(&mut self, value: i32)

Assign a builtin integral type value to an Arbi.

Source§

impl Assign<i64> for Arbi

Source§

fn assign(&mut self, value: i64)

Assign a builtin integral type value to an Arbi.

Source§

impl Assign<i8> for Arbi

Source§

fn assign(&mut self, value: i8)

Assign a builtin integral type value to an Arbi.

Source§

impl Assign<isize> for Arbi

Source§

fn assign(&mut self, value: isize)

Assign a builtin integral type value to an Arbi.

Source§

impl Assign<u128> for Arbi

Source§

fn assign(&mut self, value: u128)

Assign a builtin integral type value to an Arbi.

Source§

impl Assign<u16> for Arbi

Source§

fn assign(&mut self, value: u16)

Assign a builtin integral type value to an Arbi.

Source§

impl Assign<u32> for Arbi

Source§

fn assign(&mut self, value: u32)

Assign a builtin integral type value to an Arbi.

Source§

impl Assign<u64> for Arbi

Source§

fn assign(&mut self, value: u64)

Assign a builtin integral type value to an Arbi.

Source§

impl Assign<u8> for Arbi

Source§

fn assign(&mut self, value: u8)

Assign a builtin integral type value to an Arbi.

Source§

impl Assign<usize> for Arbi

Source§

fn assign(&mut self, value: usize)

Assign a builtin integral type value to an Arbi.

Source§

impl<'a> BitAnd<&'a Arbi> for &Arbi

Mathematically, given two integers \( x, y \) with coefficients \( x_{i}, y_{i} \) of their binary representation, the result of \( x \; \& \; y \) (bitwise AND) is an integer \( r \) with base-2 coefficients \( r_{i} \) such that \[ r_{i} = 1 \Longleftrightarrow x_{i} = 1 \wedge y_{i} = 1 \]

Source§

type Output = Arbi

The resulting type after applying the & operator.
Source§

fn bitand(self, rhs: &'a Arbi) -> Self::Output

Performs the & operation. Read more
Source§

impl<'a> BitAnd<&'a Arbi> for Arbi

See BitAnd for the mathematical semantics.

Source§

type Output = Arbi

The resulting type after applying the & operator.
Source§

fn bitand(self, rhs: &'a Self) -> Self::Output

Performs the & operation. Read more
Source§

impl BitAnd for Arbi

See BitAnd for the mathematical semantics.

Source§

type Output = Arbi

The resulting type after applying the & operator.
Source§

fn bitand(self, rhs: Self) -> Self::Output

Performs the & operation. Read more
Source§

impl<'a> BitAndAssign<&'a Arbi> for Arbi

See BitAnd for the mathematical semantics.

Source§

fn bitand_assign(&mut self, rhs: &'a Self)

Performs the &= operation. Read more
Source§

impl BitAndAssign for Arbi

See BitAnd for the mathematical semantics.

Source§

fn bitand_assign(&mut self, rhs: Self)

Performs the &= operation. Read more
Source§

impl<'a> BitOr<&'a Arbi> for &Arbi

Mathematically, given two integers \( x, y \) with coefficients \( x_{i}, y_{i} \) of their binary representation, the result of \( x \; | \; y \) (bitwise inclusive OR) is an integer \( r \) with base-2 coefficients \( r_{i} \) such that \[ r_{i} = 1 \Longleftrightarrow x_{i} = 1 \lor y_{i} = 1 \]

Source§

type Output = Arbi

The resulting type after applying the | operator.
Source§

fn bitor(self, rhs: &'a Arbi) -> Self::Output

Performs the | operation. Read more
Source§

impl<'a> BitOr<&'a Arbi> for Arbi

See BitOr for the mathematical semantics.

Source§

type Output = Arbi

The resulting type after applying the | operator.
Source§

fn bitor(self, rhs: &'a Self) -> Self::Output

Performs the | operation. Read more
Source§

impl BitOr for Arbi

See BitOr for the mathematical semantics.

Source§

type Output = Arbi

The resulting type after applying the | operator.
Source§

fn bitor(self, rhs: Self) -> Self::Output

Performs the | operation. Read more
Source§

impl<'a> BitOrAssign<&'a Arbi> for Arbi

See BitOr for the mathematical semantics.

Source§

fn bitor_assign(&mut self, rhs: &'a Self)

Performs the |= operation. Read more
Source§

impl BitOrAssign for Arbi

See BitOr for the mathematical semantics.

Source§

fn bitor_assign(&mut self, rhs: Self)

Performs the |= operation. Read more
Source§

impl<'a> BitXor<&'a Arbi> for &Arbi

Mathematically, given two integers \( x, y \) with coefficients \( x_{i}, y_{i} \) of their binary representation, the result of \( x \; ^\wedge \; y \) (bitwise exclusive OR) is an integer \( r \) with base-2 coefficients \( r_{i} \) such that \[ r_{i} = 1 \Longleftrightarrow (x_{i} = 1 \wedge y_{i} = 0) \lor (x_{i} = 0 \wedge y_{i} = 1) \]

Source§

type Output = Arbi

The resulting type after applying the ^ operator.
Source§

fn bitxor(self, rhs: &'a Arbi) -> Self::Output

Performs the ^ operation. Read more
Source§

impl<'a> BitXor<&'a Arbi> for Arbi

See BitXor for the mathematical semantics.

Source§

type Output = Arbi

The resulting type after applying the ^ operator.
Source§

fn bitxor(self, rhs: &'a Self) -> Self::Output

Performs the ^ operation. Read more
Source§

impl BitXor for Arbi

See BitXor for the mathematical semantics.

Source§

type Output = Arbi

The resulting type after applying the ^ operator.
Source§

fn bitxor(self, rhs: Self) -> Self::Output

Performs the ^ operation. Read more
Source§

impl<'a> BitXorAssign<&'a Arbi> for Arbi

See BitXor for the mathematical semantics.

Source§

fn bitxor_assign(&mut self, rhs: &'a Self)

Performs the ^= operation. Read more
Source§

impl BitXorAssign for Arbi

See BitXor for the mathematical semantics.

Source§

fn bitxor_assign(&mut self, rhs: Self)

Performs the ^= operation. Read more
Source§

impl Clone for Arbi

Source§

fn clone(&self) -> Arbi

Returns a copy of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for Arbi

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Default for Arbi

Source§

fn default() -> Arbi

Returns the “default value” for a type. Read more
Source§

impl Display for Arbi

Outputs the base-10 (decimal) representation of an Arbi integer.

§Examples

use arbi::Arbi;

let a = Arbi::from(12345);
assert_eq!(format!("{}", a), "12345");
Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl<'a> Div<&'a Arbi> for &Arbi

See the div() method.

Source§

type Output = Arbi

The resulting type after applying the / operator.
Source§

fn div(self, rhs: &'a Arbi) -> Arbi

Performs the / operation. Read more
Source§

impl<'a> Div<&'a Arbi> for Arbi

See the div() method.

Source§

type Output = Arbi

The resulting type after applying the / operator.
Source§

fn div(self, rhs: &'a Arbi) -> Arbi

Performs the / operation. Read more
Source§

impl Div for Arbi

See the div() method.

Source§

type Output = Arbi

The resulting type after applying the / operator.
Source§

fn div(self, rhs: Arbi) -> Arbi

Performs the / operation. Read more
Source§

impl<'a> DivAssign<&'a Arbi> for Arbi

See the div() method.

Source§

fn div_assign(&mut self, rhs: &'a Arbi)

Performs the /= operation. Read more
Source§

impl DivAssign for Arbi

See the div() method.

Source§

fn div_assign(&mut self, rhs: Arbi)

Performs the /= operation. Read more
Source§

impl From<&Arbi> for i128

Source§

fn from(arbi: &Arbi) -> Self

Converts to this type from the input type.
Source§

impl From<&Arbi> for i16

Source§

fn from(arbi: &Arbi) -> Self

Converts to this type from the input type.
Source§

impl From<&Arbi> for i32

Source§

fn from(arbi: &Arbi) -> Self

Converts to this type from the input type.
Source§

impl From<&Arbi> for i64

Source§

fn from(arbi: &Arbi) -> Self

Converts to this type from the input type.
Source§

impl From<&Arbi> for i8

Source§

fn from(arbi: &Arbi) -> Self

Converts to this type from the input type.
Source§

impl From<&Arbi> for isize

Source§

fn from(arbi: &Arbi) -> Self

Converts to this type from the input type.
Source§

impl From<&Arbi> for u128

Source§

fn from(arbi: &Arbi) -> Self

Converts to this type from the input type.
Source§

impl From<&Arbi> for u16

Source§

fn from(arbi: &Arbi) -> Self

Converts to this type from the input type.
Source§

impl From<&Arbi> for u32

Source§

fn from(arbi: &Arbi) -> Self

Converts to this type from the input type.
Source§

impl From<&Arbi> for u64

Source§

fn from(arbi: &Arbi) -> Self

Converts to this type from the input type.
Source§

impl From<&Arbi> for u8

Source§

fn from(arbi: &Arbi) -> Self

Converts to this type from the input type.
Source§

impl From<&Arbi> for usize

Source§

fn from(arbi: &Arbi) -> Self

Converts to this type from the input type.
Source§

impl From<&i128> for Arbi

Construct an Arbi integer from this primitive integer type value.

See impl From<i32> for Arbi.

Source§

fn from(value: &i128) -> Self

Converts to this type from the input type.
Source§

impl From<&i16> for Arbi

Construct an Arbi integer from this primitive integer type value.

See impl From<i32> for Arbi.

Source§

fn from(value: &i16) -> Self

Converts to this type from the input type.
Source§

impl From<&i32> for Arbi

Construct an Arbi integer from this primitive integer type value.

See impl From<i32> for Arbi.

Source§

fn from(value: &i32) -> Self

Converts to this type from the input type.
Source§

impl From<&i64> for Arbi

Construct an Arbi integer from this primitive integer type value.

See impl From<i32> for Arbi.

Source§

fn from(value: &i64) -> Self

Converts to this type from the input type.
Source§

impl From<&i8> for Arbi

Construct an Arbi integer from this primitive integer type value.

See impl From<i32> for Arbi.

Source§

fn from(value: &i8) -> Self

Converts to this type from the input type.
Source§

impl From<&isize> for Arbi

Construct an Arbi integer from this primitive integer type value.

See impl From<i32> for Arbi.

Source§

fn from(value: &isize) -> Self

Converts to this type from the input type.
Source§

impl From<&u128> for Arbi

Construct an Arbi integer from this primitive integer type value.

See impl From<i32> for Arbi.

Source§

fn from(value: &u128) -> Self

Converts to this type from the input type.
Source§

impl From<&u16> for Arbi

Construct an Arbi integer from this primitive integer type value.

See impl From<i32> for Arbi.

Source§

fn from(value: &u16) -> Self

Converts to this type from the input type.
Source§

impl From<&u32> for Arbi

Construct an Arbi integer from this primitive integer type value.

See impl From<i32> for Arbi.

Source§

fn from(value: &u32) -> Self

Converts to this type from the input type.
Source§

impl From<&u64> for Arbi

Construct an Arbi integer from this primitive integer type value.

See impl From<i32> for Arbi.

Source§

fn from(value: &u64) -> Self

Converts to this type from the input type.
Source§

impl From<&u8> for Arbi

Construct an Arbi integer from this primitive integer type value.

See impl From<i32> for Arbi.

Source§

fn from(value: &u8) -> Self

Converts to this type from the input type.
Source§

impl From<&usize> for Arbi

Construct an Arbi integer from this primitive integer type value.

See impl From<i32> for Arbi.

Source§

fn from(value: &usize) -> Self

Converts to this type from the input type.
Source§

impl From<Arbi> for i128

Source§

fn from(arbi: Arbi) -> Self

Converts to this type from the input type.
Source§

impl From<Arbi> for i16

Source§

fn from(arbi: Arbi) -> Self

Converts to this type from the input type.
Source§

impl From<Arbi> for i32

Source§

fn from(arbi: Arbi) -> Self

Converts to this type from the input type.
Source§

impl From<Arbi> for i64

Source§

fn from(arbi: Arbi) -> Self

Converts to this type from the input type.
Source§

impl From<Arbi> for i8

Source§

fn from(arbi: Arbi) -> Self

Converts to this type from the input type.
Source§

impl From<Arbi> for isize

Source§

fn from(arbi: Arbi) -> Self

Converts to this type from the input type.
Source§

impl From<Arbi> for u128

Source§

fn from(arbi: Arbi) -> Self

Converts to this type from the input type.
Source§

impl From<Arbi> for u16

Source§

fn from(arbi: Arbi) -> Self

Converts to this type from the input type.
Source§

impl From<Arbi> for u32

Source§

fn from(arbi: Arbi) -> Self

Converts to this type from the input type.
Source§

impl From<Arbi> for u64

Source§

fn from(arbi: Arbi) -> Self

Converts to this type from the input type.
Source§

impl From<Arbi> for u8

Source§

fn from(arbi: Arbi) -> Self

Converts to this type from the input type.
Source§

impl From<Arbi> for usize

Source§

fn from(arbi: Arbi) -> Self

Converts to this type from the input type.
Source§

impl From<f64> for Arbi

Construct an Arbi integer from a floating-point value.

§Panic

Panics when attempting to convert a NaN or infinity.

§Note

In Rust, when casting a primitive float to a primitive integer type, NaNs are converted to 0 and values with large magnitudes and infinities are saturated to the maximum and minimum values of the integer type.

In contrast, this function panics when NaN or infinity is encountered.

Otherwise, the semantics of this function are consistent with Rust’s built-in behavior for casting floats to integers.

§Examples

use arbi::Arbi;

let a = Arbi::from(12345.6789);
assert_eq!(a, 12345);
assert_eq!(a, 12345.6789 as i32)

Attempting to convert infinity panics.

use arbi::Arbi;

let a = Arbi::from(f64::INFINITY);

Attempting to convert NaN panics.

use arbi::Arbi;

let b = Arbi::from(f64::NAN);
§Complexity

\( O(1) \)

Source§

fn from(value: f64) -> Self

Converts to this type from the input type.
Source§

impl From<i128> for Arbi

Construct an Arbi integer from this primitive integer type value.

This is implemented for all primitive integer types.

§Examples

use arbi::Arbi;

let a = Arbi::from(u128::MAX);
assert_eq!(a, u128::MAX);

let b = Arbi::from(i128::MIN);
assert_eq!(b, i128::MIN);

// Also works with references
let c = Arbi::from(&i128::MIN);
assert_eq!(c, i128::MIN);
§Complexity

\( O(1) \)

Source§

fn from(value: i128) -> Self

Converts to this type from the input type.
Source§

impl From<i16> for Arbi

Construct an Arbi integer from this primitive integer type value.

This is implemented for all primitive integer types.

§Examples

use arbi::Arbi;

let a = Arbi::from(u128::MAX);
assert_eq!(a, u128::MAX);

let b = Arbi::from(i128::MIN);
assert_eq!(b, i128::MIN);

// Also works with references
let c = Arbi::from(&i128::MIN);
assert_eq!(c, i128::MIN);
§Complexity

\( O(1) \)

Source§

fn from(value: i16) -> Self

Converts to this type from the input type.
Source§

impl From<i32> for Arbi

Construct an Arbi integer from this primitive integer type value.

This is implemented for all primitive integer types.

§Examples

use arbi::Arbi;

let a = Arbi::from(u128::MAX);
assert_eq!(a, u128::MAX);

let b = Arbi::from(i128::MIN);
assert_eq!(b, i128::MIN);

// Also works with references
let c = Arbi::from(&i128::MIN);
assert_eq!(c, i128::MIN);
§Complexity

\( O(1) \)

Source§

fn from(value: i32) -> Self

Converts to this type from the input type.
Source§

impl From<i64> for Arbi

Construct an Arbi integer from this primitive integer type value.

This is implemented for all primitive integer types.

§Examples

use arbi::Arbi;

let a = Arbi::from(u128::MAX);
assert_eq!(a, u128::MAX);

let b = Arbi::from(i128::MIN);
assert_eq!(b, i128::MIN);

// Also works with references
let c = Arbi::from(&i128::MIN);
assert_eq!(c, i128::MIN);
§Complexity

\( O(1) \)

Source§

fn from(value: i64) -> Self

Converts to this type from the input type.
Source§

impl From<i8> for Arbi

Construct an Arbi integer from this primitive integer type value.

This is implemented for all primitive integer types.

§Examples

use arbi::Arbi;

let a = Arbi::from(u128::MAX);
assert_eq!(a, u128::MAX);

let b = Arbi::from(i128::MIN);
assert_eq!(b, i128::MIN);

// Also works with references
let c = Arbi::from(&i128::MIN);
assert_eq!(c, i128::MIN);
§Complexity

\( O(1) \)

Source§

fn from(value: i8) -> Self

Converts to this type from the input type.
Source§

impl From<isize> for Arbi

Construct an Arbi integer from this primitive integer type value.

This is implemented for all primitive integer types.

§Examples

use arbi::Arbi;

let a = Arbi::from(u128::MAX);
assert_eq!(a, u128::MAX);

let b = Arbi::from(i128::MIN);
assert_eq!(b, i128::MIN);

// Also works with references
let c = Arbi::from(&i128::MIN);
assert_eq!(c, i128::MIN);
§Complexity

\( O(1) \)

Source§

fn from(value: isize) -> Self

Converts to this type from the input type.
Source§

impl From<u128> for Arbi

Construct an Arbi integer from this primitive integer type value.

This is implemented for all primitive integer types.

§Examples

use arbi::Arbi;

let a = Arbi::from(u128::MAX);
assert_eq!(a, u128::MAX);

let b = Arbi::from(i128::MIN);
assert_eq!(b, i128::MIN);

// Also works with references
let c = Arbi::from(&i128::MIN);
assert_eq!(c, i128::MIN);
§Complexity

\( O(1) \)

Source§

fn from(value: u128) -> Self

Converts to this type from the input type.
Source§

impl From<u16> for Arbi

Construct an Arbi integer from this primitive integer type value.

This is implemented for all primitive integer types.

§Examples

use arbi::Arbi;

let a = Arbi::from(u128::MAX);
assert_eq!(a, u128::MAX);

let b = Arbi::from(i128::MIN);
assert_eq!(b, i128::MIN);

// Also works with references
let c = Arbi::from(&i128::MIN);
assert_eq!(c, i128::MIN);
§Complexity

\( O(1) \)

Source§

fn from(value: u16) -> Self

Converts to this type from the input type.
Source§

impl From<u32> for Arbi

Construct an Arbi integer from this primitive integer type value.

This is implemented for all primitive integer types.

§Examples

use arbi::Arbi;

let a = Arbi::from(u128::MAX);
assert_eq!(a, u128::MAX);

let b = Arbi::from(i128::MIN);
assert_eq!(b, i128::MIN);

// Also works with references
let c = Arbi::from(&i128::MIN);
assert_eq!(c, i128::MIN);
§Complexity

\( O(1) \)

Source§

fn from(value: u32) -> Self

Converts to this type from the input type.
Source§

impl From<u64> for Arbi

Construct an Arbi integer from this primitive integer type value.

This is implemented for all primitive integer types.

§Examples

use arbi::Arbi;

let a = Arbi::from(u128::MAX);
assert_eq!(a, u128::MAX);

let b = Arbi::from(i128::MIN);
assert_eq!(b, i128::MIN);

// Also works with references
let c = Arbi::from(&i128::MIN);
assert_eq!(c, i128::MIN);
§Complexity

\( O(1) \)

Source§

fn from(value: u64) -> Self

Converts to this type from the input type.
Source§

impl From<u8> for Arbi

Construct an Arbi integer from this primitive integer type value.

This is implemented for all primitive integer types.

§Examples

use arbi::Arbi;

let a = Arbi::from(u128::MAX);
assert_eq!(a, u128::MAX);

let b = Arbi::from(i128::MIN);
assert_eq!(b, i128::MIN);

// Also works with references
let c = Arbi::from(&i128::MIN);
assert_eq!(c, i128::MIN);
§Complexity

\( O(1) \)

Source§

fn from(value: u8) -> Self

Converts to this type from the input type.
Source§

impl From<usize> for Arbi

Construct an Arbi integer from this primitive integer type value.

This is implemented for all primitive integer types.

§Examples

use arbi::Arbi;

let a = Arbi::from(u128::MAX);
assert_eq!(a, u128::MAX);

let b = Arbi::from(i128::MIN);
assert_eq!(b, i128::MIN);

// Also works with references
let c = Arbi::from(&i128::MIN);
assert_eq!(c, i128::MIN);
§Complexity

\( O(1) \)

Source§

fn from(value: usize) -> Self

Converts to this type from the input type.
Source§

impl FromStr for Arbi

Source§

fn from_str(src: &str) -> Result<Self, Self::Err>

Uses Arbi::from_str_radix() with base 10.

§Examples
use arbi::Arbi;
use core::str::FromStr;

let a = Arbi::from_str("-987654321").unwrap();
assert_eq!(a, -987654321);

let b = "123456789".parse::<Arbi>().unwrap();
assert_eq!(b, 123456789);
Source§

type Err = ParseError

The associated error which can be returned from parsing.
Source§

impl<'b> Mul<&'b Arbi> for &Arbi

Multiply an Arbi integer by another Arbi integer.

§Examples

use arbi::Arbi;

let mut a = Arbi::from(i16::MIN);
let mut b = a.clone();

a = &a * &b;
assert_eq!(a, (i16::MIN as i128).pow(2));

a = a * &b;
assert_eq!(a, (i16::MIN as i128).pow(3));

a *= &b;
assert_eq!(a, (i16::MIN as i128).pow(4));

a *= b;
assert_eq!(a, (i16::MIN as i128).pow(5));

a = &a * &a;
assert_eq!(
    a,
    Arbi::from_str_radix("40000000000000000000000000000000000000", 16)
        .unwrap()
);
§Complexity

\( O(n^{\log_{2}(3)}) \approx O(n^{1.58}) \)

Source§

type Output = Arbi

The resulting type after applying the * operator.
Source§

fn mul(self, rhs: &'b Arbi) -> Self::Output

Performs the * operation. Read more
Source§

impl<'a> Mul<&'a Arbi> for Arbi

Source§

type Output = Arbi

The resulting type after applying the * operator.
Source§

fn mul(self, rhs: &'a Arbi) -> Self

Performs the * operation. Read more
Source§

impl Mul for Arbi

Source§

type Output = Arbi

The resulting type after applying the * operator.
Source§

fn mul(self, rhs: Self) -> Self::Output

Performs the * operation. Read more
Source§

impl MulAssign<&Arbi> for Arbi

Source§

fn mul_assign(&mut self, rhs: &Arbi)

Performs the *= operation. Read more
Source§

impl MulAssign for Arbi

Source§

fn mul_assign(&mut self, rhs: Arbi)

Performs the *= operation. Read more
Source§

impl Neg for &Arbi

Source§

type Output = Arbi

The resulting type after applying the - operator.
Source§

fn neg(self) -> Arbi

Performs the unary - operation. Read more
Source§

impl Neg for Arbi

Source§

type Output = Arbi

The resulting type after applying the - operator.
Source§

fn neg(self) -> Self

Performs the unary - operation. Read more
Source§

impl Not for &Arbi

Unary complement operator. Return a new integer representing the ones’ complement of this integer.

Currently, this involves cloning the referenced Arbi integer.

§Example

use arbi::{Arbi, Assign};

let mut a = Arbi::zero();
a = !&a;
assert_eq!(a, -1);
assert_eq!(a, !0);

a.assign(u16::MAX);
a = !&a;
assert_eq!(a, -65536);
assert_eq!(a, !(u16::MAX as i32));
§Complexity

\( O(n) \)

Source§

type Output = Arbi

The resulting type after applying the ! operator.
Source§

fn not(self) -> Self::Output

Performs the unary ! operation. Read more
Source§

impl Not for Arbi

Unary complement operator. Return the ones’ complement of this integer.

This is done in-place, using the moved-in value.

§Example

use arbi::{Arbi, Assign};

let mut a = Arbi::zero();
a = !a; // in-place
assert_eq!(a, -1);
assert_eq!(a, !0);

a.assign(u16::MAX);
a = !a; // in-place
assert_eq!(a, -65536);
assert_eq!(a, !(u16::MAX as i32));
§Complexity

\( O(n) \)

Source§

type Output = Arbi

The resulting type after applying the ! operator.
Source§

fn not(self) -> Self::Output

Performs the unary ! operation. Read more
Source§

impl Ord for Arbi

Source§

fn cmp(&self, other: &Self) -> Ordering

This method returns an Ordering between self and other. Read more
1.21.0 · Source§

fn max(self, other: Self) -> Self
where Self: Sized,

Compares and returns the maximum of two values. Read more
1.21.0 · Source§

fn min(self, other: Self) -> Self
where Self: Sized,

Compares and returns the minimum of two values. Read more
1.50.0 · Source§

fn clamp(self, min: Self, max: Self) -> Self
where Self: Sized,

Restrict a value to a certain interval. Read more
Source§

impl PartialEq<Arbi> for f64

Source§

fn eq(&self, other: &Arbi) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl PartialEq<Arbi> for i128

Test if this primitive integer value is equal to an Arbi integer.

This is implemented for all primitive integer types.

§Examples

use arbi::Arbi;

let a = Arbi::from(u64::MAX);
assert_eq!(u64::MAX, a);
assert_ne!(u64::MAX - 1, a);
§Complexity

\( O(1) \)

Source§

fn eq(&self, other: &Arbi) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl PartialEq<Arbi> for i16

Test if this primitive integer value is equal to an Arbi integer.

This is implemented for all primitive integer types.

§Examples

use arbi::Arbi;

let a = Arbi::from(u64::MAX);
assert_eq!(u64::MAX, a);
assert_ne!(u64::MAX - 1, a);
§Complexity

\( O(1) \)

Source§

fn eq(&self, other: &Arbi) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl PartialEq<Arbi> for i32

Test if this primitive integer value is equal to an Arbi integer.

This is implemented for all primitive integer types.

§Examples

use arbi::Arbi;

let a = Arbi::from(u64::MAX);
assert_eq!(u64::MAX, a);
assert_ne!(u64::MAX - 1, a);
§Complexity

\( O(1) \)

Source§

fn eq(&self, other: &Arbi) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl PartialEq<Arbi> for i64

Test if this primitive integer value is equal to an Arbi integer.

This is implemented for all primitive integer types.

§Examples

use arbi::Arbi;

let a = Arbi::from(u64::MAX);
assert_eq!(u64::MAX, a);
assert_ne!(u64::MAX - 1, a);
§Complexity

\( O(1) \)

Source§

fn eq(&self, other: &Arbi) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl PartialEq<Arbi> for i8

Test if this primitive integer value is equal to an Arbi integer.

This is implemented for all primitive integer types.

§Examples

use arbi::Arbi;

let a = Arbi::from(u64::MAX);
assert_eq!(u64::MAX, a);
assert_ne!(u64::MAX - 1, a);
§Complexity

\( O(1) \)

Source§

fn eq(&self, other: &Arbi) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl PartialEq<Arbi> for isize

Test if this primitive integer value is equal to an Arbi integer.

This is implemented for all primitive integer types.

§Examples

use arbi::Arbi;

let a = Arbi::from(u64::MAX);
assert_eq!(u64::MAX, a);
assert_ne!(u64::MAX - 1, a);
§Complexity

\( O(1) \)

Source§

fn eq(&self, other: &Arbi) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl PartialEq<Arbi> for u128

Test if this primitive integer value is equal to an Arbi integer.

This is implemented for all primitive integer types.

§Examples

use arbi::Arbi;

let a = Arbi::from(u64::MAX);
assert_eq!(u64::MAX, a);
assert_ne!(u64::MAX - 1, a);
§Complexity

\( O(1) \)

Source§

fn eq(&self, other: &Arbi) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl PartialEq<Arbi> for u16

Test if this primitive integer value is equal to an Arbi integer.

This is implemented for all primitive integer types.

§Examples

use arbi::Arbi;

let a = Arbi::from(u64::MAX);
assert_eq!(u64::MAX, a);
assert_ne!(u64::MAX - 1, a);
§Complexity

\( O(1) \)

Source§

fn eq(&self, other: &Arbi) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl PartialEq<Arbi> for u32

Test if this primitive integer value is equal to an Arbi integer.

This is implemented for all primitive integer types.

§Examples

use arbi::Arbi;

let a = Arbi::from(u64::MAX);
assert_eq!(u64::MAX, a);
assert_ne!(u64::MAX - 1, a);
§Complexity

\( O(1) \)

Source§

fn eq(&self, other: &Arbi) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl PartialEq<Arbi> for u64

Test if this primitive integer value is equal to an Arbi integer.

This is implemented for all primitive integer types.

§Examples

use arbi::Arbi;

let a = Arbi::from(u64::MAX);
assert_eq!(u64::MAX, a);
assert_ne!(u64::MAX - 1, a);
§Complexity

\( O(1) \)

Source§

fn eq(&self, other: &Arbi) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl PartialEq<Arbi> for u8

Test if this primitive integer value is equal to an Arbi integer.

This is implemented for all primitive integer types.

§Examples

use arbi::Arbi;

let a = Arbi::from(u64::MAX);
assert_eq!(u64::MAX, a);
assert_ne!(u64::MAX - 1, a);
§Complexity

\( O(1) \)

Source§

fn eq(&self, other: &Arbi) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl PartialEq<Arbi> for usize

Test if this primitive integer value is equal to an Arbi integer.

This is implemented for all primitive integer types.

§Examples

use arbi::Arbi;

let a = Arbi::from(u64::MAX);
assert_eq!(u64::MAX, a);
assert_ne!(u64::MAX - 1, a);
§Complexity

\( O(1) \)

Source§

fn eq(&self, other: &Arbi) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl PartialEq<f64> for &Arbi

Source§

fn eq(&self, other: &f64) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl PartialEq<f64> for Arbi

Test if this Arbi integer is equal to a floating-point value.

See also PartialOrd<f64> for Arbi for a description of the semantics of comparing an Arbi to a floating-point value.

§Examples

use arbi::Arbi;

let a = Arbi::from(f64::MAX);

assert_eq!(a, f64::MAX);
assert_ne!(a, f64::MIN);

// Reverse also implemented
assert_eq!(f64::MAX, a);
assert_ne!(f64::MIN, a);
§Complexity

\( O(1) \)

Source§

fn eq(&self, other: &f64) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl PartialEq<i128> for &Arbi

Source§

fn eq(&self, other: &i128) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl PartialEq<i128> for &mut Arbi

Source§

fn eq(&self, other: &i128) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl PartialEq<i128> for Arbi

Test if this Arbi integer is equal to a primitive integer value.

This is implemented for all primitive integer types.

§Examples

use arbi::Arbi;

let a = Arbi::from(u64::MAX);
assert_eq!(a, u64::MAX);
assert_ne!(a, u64::MAX - 1);
§Complexity

\( O(1) \)

Source§

fn eq(&self, other: &i128) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl PartialEq<i16> for &Arbi

Source§

fn eq(&self, other: &i16) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl PartialEq<i16> for &mut Arbi

Source§

fn eq(&self, other: &i16) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl PartialEq<i16> for Arbi

Test if this Arbi integer is equal to a primitive integer value.

This is implemented for all primitive integer types.

§Examples

use arbi::Arbi;

let a = Arbi::from(u64::MAX);
assert_eq!(a, u64::MAX);
assert_ne!(a, u64::MAX - 1);
§Complexity

\( O(1) \)

Source§

fn eq(&self, other: &i16) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl PartialEq<i32> for &Arbi

Source§

fn eq(&self, other: &i32) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl PartialEq<i32> for &mut Arbi

Source§

fn eq(&self, other: &i32) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl PartialEq<i32> for Arbi

Test if this Arbi integer is equal to a primitive integer value.

This is implemented for all primitive integer types.

§Examples

use arbi::Arbi;

let a = Arbi::from(u64::MAX);
assert_eq!(a, u64::MAX);
assert_ne!(a, u64::MAX - 1);
§Complexity

\( O(1) \)

Source§

fn eq(&self, other: &i32) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl PartialEq<i64> for &Arbi

Source§

fn eq(&self, other: &i64) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl PartialEq<i64> for &mut Arbi

Source§

fn eq(&self, other: &i64) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl PartialEq<i64> for Arbi

Test if this Arbi integer is equal to a primitive integer value.

This is implemented for all primitive integer types.

§Examples

use arbi::Arbi;

let a = Arbi::from(u64::MAX);
assert_eq!(a, u64::MAX);
assert_ne!(a, u64::MAX - 1);
§Complexity

\( O(1) \)

Source§

fn eq(&self, other: &i64) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl PartialEq<i8> for &Arbi

Source§

fn eq(&self, other: &i8) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl PartialEq<i8> for &mut Arbi

Source§

fn eq(&self, other: &i8) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl PartialEq<i8> for Arbi

Test if this Arbi integer is equal to a primitive integer value.

This is implemented for all primitive integer types.

§Examples

use arbi::Arbi;

let a = Arbi::from(u64::MAX);
assert_eq!(a, u64::MAX);
assert_ne!(a, u64::MAX - 1);
§Complexity

\( O(1) \)

Source§

fn eq(&self, other: &i8) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl PartialEq<isize> for &Arbi

Source§

fn eq(&self, other: &isize) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl PartialEq<isize> for &mut Arbi

Source§

fn eq(&self, other: &isize) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl PartialEq<isize> for Arbi

Test if this Arbi integer is equal to a primitive integer value.

This is implemented for all primitive integer types.

§Examples

use arbi::Arbi;

let a = Arbi::from(u64::MAX);
assert_eq!(a, u64::MAX);
assert_ne!(a, u64::MAX - 1);
§Complexity

\( O(1) \)

Source§

fn eq(&self, other: &isize) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl PartialEq<u128> for &Arbi

Source§

fn eq(&self, other: &u128) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl PartialEq<u128> for &mut Arbi

Source§

fn eq(&self, other: &u128) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl PartialEq<u128> for Arbi

Test if this Arbi integer is equal to a primitive integer value.

This is implemented for all primitive integer types.

§Examples

use arbi::Arbi;

let a = Arbi::from(u64::MAX);
assert_eq!(a, u64::MAX);
assert_ne!(a, u64::MAX - 1);
§Complexity

\( O(1) \)

Source§

fn eq(&self, other: &u128) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl PartialEq<u16> for &Arbi

Source§

fn eq(&self, other: &u16) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl PartialEq<u16> for &mut Arbi

Source§

fn eq(&self, other: &u16) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl PartialEq<u16> for Arbi

Test if this Arbi integer is equal to a primitive integer value.

This is implemented for all primitive integer types.

§Examples

use arbi::Arbi;

let a = Arbi::from(u64::MAX);
assert_eq!(a, u64::MAX);
assert_ne!(a, u64::MAX - 1);
§Complexity

\( O(1) \)

Source§

fn eq(&self, other: &u16) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl PartialEq<u32> for &Arbi

Source§

fn eq(&self, other: &u32) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl PartialEq<u32> for &mut Arbi

Source§

fn eq(&self, other: &u32) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl PartialEq<u32> for Arbi

Test if this Arbi integer is equal to a primitive integer value.

This is implemented for all primitive integer types.

§Examples

use arbi::Arbi;

let a = Arbi::from(u64::MAX);
assert_eq!(a, u64::MAX);
assert_ne!(a, u64::MAX - 1);
§Complexity

\( O(1) \)

Source§

fn eq(&self, other: &u32) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl PartialEq<u64> for &Arbi

Source§

fn eq(&self, other: &u64) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl PartialEq<u64> for &mut Arbi

Source§

fn eq(&self, other: &u64) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl PartialEq<u64> for Arbi

Test if this Arbi integer is equal to a primitive integer value.

This is implemented for all primitive integer types.

§Examples

use arbi::Arbi;

let a = Arbi::from(u64::MAX);
assert_eq!(a, u64::MAX);
assert_ne!(a, u64::MAX - 1);
§Complexity

\( O(1) \)

Source§

fn eq(&self, other: &u64) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl PartialEq<u8> for &Arbi

Source§

fn eq(&self, other: &u8) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl PartialEq<u8> for &mut Arbi

Source§

fn eq(&self, other: &u8) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl PartialEq<u8> for Arbi

Test if this Arbi integer is equal to a primitive integer value.

This is implemented for all primitive integer types.

§Examples

use arbi::Arbi;

let a = Arbi::from(u64::MAX);
assert_eq!(a, u64::MAX);
assert_ne!(a, u64::MAX - 1);
§Complexity

\( O(1) \)

Source§

fn eq(&self, other: &u8) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl PartialEq<usize> for &Arbi

Source§

fn eq(&self, other: &usize) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl PartialEq<usize> for &mut Arbi

Source§

fn eq(&self, other: &usize) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl PartialEq<usize> for Arbi

Test if this Arbi integer is equal to a primitive integer value.

This is implemented for all primitive integer types.

§Examples

use arbi::Arbi;

let a = Arbi::from(u64::MAX);
assert_eq!(a, u64::MAX);
assert_ne!(a, u64::MAX - 1);
§Complexity

\( O(1) \)

Source§

fn eq(&self, other: &usize) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl PartialEq for Arbi

Source§

fn eq(&self, other: &Self) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl PartialOrd<Arbi> for f64

Source§

fn partial_cmp(&self, other: &Arbi) -> Option<Ordering>

This method returns an ordering between self and other values if one exists. Read more
1.0.0 · Source§

fn lt(&self, other: &Rhs) -> bool

Tests less than (for self and other) and is used by the < operator. Read more
1.0.0 · Source§

fn le(&self, other: &Rhs) -> bool

Tests less than or equal to (for self and other) and is used by the <= operator. Read more
1.0.0 · Source§

fn gt(&self, other: &Rhs) -> bool

Tests greater than (for self and other) and is used by the > operator. Read more
1.0.0 · Source§

fn ge(&self, other: &Rhs) -> bool

Tests greater than or equal to (for self and other) and is used by the >= operator. Read more
Source§

impl PartialOrd<Arbi> for i128

Compare the value of this primitive integer value to an Arbi integer.

This is implemented for all primitive integer types.

§Examples

use arbi::Arbi;

let a = Arbi::from(u64::MAX);
assert!(0 < a);
assert!(u128::MAX > a);
assert!(0 <= a);
assert!(u128::MAX >= a);
§Complexity

\( O(1) \)

Source§

fn partial_cmp(&self, other: &Arbi) -> Option<Ordering>

This method returns an ordering between self and other values if one exists. Read more
1.0.0 · Source§

fn lt(&self, other: &Rhs) -> bool

Tests less than (for self and other) and is used by the < operator. Read more
1.0.0 · Source§

fn le(&self, other: &Rhs) -> bool

Tests less than or equal to (for self and other) and is used by the <= operator. Read more
1.0.0 · Source§

fn gt(&self, other: &Rhs) -> bool

Tests greater than (for self and other) and is used by the > operator. Read more
1.0.0 · Source§

fn ge(&self, other: &Rhs) -> bool

Tests greater than or equal to (for self and other) and is used by the >= operator. Read more
Source§

impl PartialOrd<Arbi> for i16

Compare the value of this primitive integer value to an Arbi integer.

This is implemented for all primitive integer types.

§Examples

use arbi::Arbi;

let a = Arbi::from(u64::MAX);
assert!(0 < a);
assert!(u128::MAX > a);
assert!(0 <= a);
assert!(u128::MAX >= a);
§Complexity

\( O(1) \)

Source§

fn partial_cmp(&self, other: &Arbi) -> Option<Ordering>

This method returns an ordering between self and other values if one exists. Read more
1.0.0 · Source§

fn lt(&self, other: &Rhs) -> bool

Tests less than (for self and other) and is used by the < operator. Read more
1.0.0 · Source§

fn le(&self, other: &Rhs) -> bool

Tests less than or equal to (for self and other) and is used by the <= operator. Read more
1.0.0 · Source§

fn gt(&self, other: &Rhs) -> bool

Tests greater than (for self and other) and is used by the > operator. Read more
1.0.0 · Source§

fn ge(&self, other: &Rhs) -> bool

Tests greater than or equal to (for self and other) and is used by the >= operator. Read more
Source§

impl PartialOrd<Arbi> for i32

Compare the value of this primitive integer value to an Arbi integer.

This is implemented for all primitive integer types.

§Examples

use arbi::Arbi;

let a = Arbi::from(u64::MAX);
assert!(0 < a);
assert!(u128::MAX > a);
assert!(0 <= a);
assert!(u128::MAX >= a);
§Complexity

\( O(1) \)

Source§

fn partial_cmp(&self, other: &Arbi) -> Option<Ordering>

This method returns an ordering between self and other values if one exists. Read more
1.0.0 · Source§

fn lt(&self, other: &Rhs) -> bool

Tests less than (for self and other) and is used by the < operator. Read more
1.0.0 · Source§

fn le(&self, other: &Rhs) -> bool

Tests less than or equal to (for self and other) and is used by the <= operator. Read more
1.0.0 · Source§

fn gt(&self, other: &Rhs) -> bool

Tests greater than (for self and other) and is used by the > operator. Read more
1.0.0 · Source§

fn ge(&self, other: &Rhs) -> bool

Tests greater than or equal to (for self and other) and is used by the >= operator. Read more
Source§

impl PartialOrd<Arbi> for i64

Compare the value of this primitive integer value to an Arbi integer.

This is implemented for all primitive integer types.

§Examples

use arbi::Arbi;

let a = Arbi::from(u64::MAX);
assert!(0 < a);
assert!(u128::MAX > a);
assert!(0 <= a);
assert!(u128::MAX >= a);
§Complexity

\( O(1) \)

Source§

fn partial_cmp(&self, other: &Arbi) -> Option<Ordering>

This method returns an ordering between self and other values if one exists. Read more
1.0.0 · Source§

fn lt(&self, other: &Rhs) -> bool

Tests less than (for self and other) and is used by the < operator. Read more
1.0.0 · Source§

fn le(&self, other: &Rhs) -> bool

Tests less than or equal to (for self and other) and is used by the <= operator. Read more
1.0.0 · Source§

fn gt(&self, other: &Rhs) -> bool

Tests greater than (for self and other) and is used by the > operator. Read more
1.0.0 · Source§

fn ge(&self, other: &Rhs) -> bool

Tests greater than or equal to (for self and other) and is used by the >= operator. Read more
Source§

impl PartialOrd<Arbi> for i8

Compare the value of this primitive integer value to an Arbi integer.

This is implemented for all primitive integer types.

§Examples

use arbi::Arbi;

let a = Arbi::from(u64::MAX);
assert!(0 < a);
assert!(u128::MAX > a);
assert!(0 <= a);
assert!(u128::MAX >= a);
§Complexity

\( O(1) \)

Source§

fn partial_cmp(&self, other: &Arbi) -> Option<Ordering>

This method returns an ordering between self and other values if one exists. Read more
1.0.0 · Source§

fn lt(&self, other: &Rhs) -> bool

Tests less than (for self and other) and is used by the < operator. Read more
1.0.0 · Source§

fn le(&self, other: &Rhs) -> bool

Tests less than or equal to (for self and other) and is used by the <= operator. Read more
1.0.0 · Source§

fn gt(&self, other: &Rhs) -> bool

Tests greater than (for self and other) and is used by the > operator. Read more
1.0.0 · Source§

fn ge(&self, other: &Rhs) -> bool

Tests greater than or equal to (for self and other) and is used by the >= operator. Read more
Source§

impl PartialOrd<Arbi> for isize

Compare the value of this primitive integer value to an Arbi integer.

This is implemented for all primitive integer types.

§Examples

use arbi::Arbi;

let a = Arbi::from(u64::MAX);
assert!(0 < a);
assert!(u128::MAX > a);
assert!(0 <= a);
assert!(u128::MAX >= a);
§Complexity

\( O(1) \)

Source§

fn partial_cmp(&self, other: &Arbi) -> Option<Ordering>

This method returns an ordering between self and other values if one exists. Read more
1.0.0 · Source§

fn lt(&self, other: &Rhs) -> bool

Tests less than (for self and other) and is used by the < operator. Read more
1.0.0 · Source§

fn le(&self, other: &Rhs) -> bool

Tests less than or equal to (for self and other) and is used by the <= operator. Read more
1.0.0 · Source§

fn gt(&self, other: &Rhs) -> bool

Tests greater than (for self and other) and is used by the > operator. Read more
1.0.0 · Source§

fn ge(&self, other: &Rhs) -> bool

Tests greater than or equal to (for self and other) and is used by the >= operator. Read more
Source§

impl PartialOrd<Arbi> for u128

Compare the value of this primitive integer value to an Arbi integer.

This is implemented for all primitive integer types.

§Examples

use arbi::Arbi;

let a = Arbi::from(u64::MAX);
assert!(0 < a);
assert!(u128::MAX > a);
assert!(0 <= a);
assert!(u128::MAX >= a);
§Complexity

\( O(1) \)

Source§

fn partial_cmp(&self, other: &Arbi) -> Option<Ordering>

This method returns an ordering between self and other values if one exists. Read more
1.0.0 · Source§

fn lt(&self, other: &Rhs) -> bool

Tests less than (for self and other) and is used by the < operator. Read more
1.0.0 · Source§

fn le(&self, other: &Rhs) -> bool

Tests less than or equal to (for self and other) and is used by the <= operator. Read more
1.0.0 · Source§

fn gt(&self, other: &Rhs) -> bool

Tests greater than (for self and other) and is used by the > operator. Read more
1.0.0 · Source§

fn ge(&self, other: &Rhs) -> bool

Tests greater than or equal to (for self and other) and is used by the >= operator. Read more
Source§

impl PartialOrd<Arbi> for u16

Compare the value of this primitive integer value to an Arbi integer.

This is implemented for all primitive integer types.

§Examples

use arbi::Arbi;

let a = Arbi::from(u64::MAX);
assert!(0 < a);
assert!(u128::MAX > a);
assert!(0 <= a);
assert!(u128::MAX >= a);
§Complexity

\( O(1) \)

Source§

fn partial_cmp(&self, other: &Arbi) -> Option<Ordering>

This method returns an ordering between self and other values if one exists. Read more
1.0.0 · Source§

fn lt(&self, other: &Rhs) -> bool

Tests less than (for self and other) and is used by the < operator. Read more
1.0.0 · Source§

fn le(&self, other: &Rhs) -> bool

Tests less than or equal to (for self and other) and is used by the <= operator. Read more
1.0.0 · Source§

fn gt(&self, other: &Rhs) -> bool

Tests greater than (for self and other) and is used by the > operator. Read more
1.0.0 · Source§

fn ge(&self, other: &Rhs) -> bool

Tests greater than or equal to (for self and other) and is used by the >= operator. Read more
Source§

impl PartialOrd<Arbi> for u32

Compare the value of this primitive integer value to an Arbi integer.

This is implemented for all primitive integer types.

§Examples

use arbi::Arbi;

let a = Arbi::from(u64::MAX);
assert!(0 < a);
assert!(u128::MAX > a);
assert!(0 <= a);
assert!(u128::MAX >= a);
§Complexity

\( O(1) \)

Source§

fn partial_cmp(&self, other: &Arbi) -> Option<Ordering>

This method returns an ordering between self and other values if one exists. Read more
1.0.0 · Source§

fn lt(&self, other: &Rhs) -> bool

Tests less than (for self and other) and is used by the < operator. Read more
1.0.0 · Source§

fn le(&self, other: &Rhs) -> bool

Tests less than or equal to (for self and other) and is used by the <= operator. Read more
1.0.0 · Source§

fn gt(&self, other: &Rhs) -> bool

Tests greater than (for self and other) and is used by the > operator. Read more
1.0.0 · Source§

fn ge(&self, other: &Rhs) -> bool

Tests greater than or equal to (for self and other) and is used by the >= operator. Read more
Source§

impl PartialOrd<Arbi> for u64

Compare the value of this primitive integer value to an Arbi integer.

This is implemented for all primitive integer types.

§Examples

use arbi::Arbi;

let a = Arbi::from(u64::MAX);
assert!(0 < a);
assert!(u128::MAX > a);
assert!(0 <= a);
assert!(u128::MAX >= a);
§Complexity

\( O(1) \)

Source§

fn partial_cmp(&self, other: &Arbi) -> Option<Ordering>

This method returns an ordering between self and other values if one exists. Read more
1.0.0 · Source§

fn lt(&self, other: &Rhs) -> bool

Tests less than (for self and other) and is used by the < operator. Read more
1.0.0 · Source§

fn le(&self, other: &Rhs) -> bool

Tests less than or equal to (for self and other) and is used by the <= operator. Read more
1.0.0 · Source§

fn gt(&self, other: &Rhs) -> bool

Tests greater than (for self and other) and is used by the > operator. Read more
1.0.0 · Source§

fn ge(&self, other: &Rhs) -> bool

Tests greater than or equal to (for self and other) and is used by the >= operator. Read more
Source§

impl PartialOrd<Arbi> for u8

Compare the value of this primitive integer value to an Arbi integer.

This is implemented for all primitive integer types.

§Examples

use arbi::Arbi;

let a = Arbi::from(u64::MAX);
assert!(0 < a);
assert!(u128::MAX > a);
assert!(0 <= a);
assert!(u128::MAX >= a);
§Complexity

\( O(1) \)

Source§

fn partial_cmp(&self, other: &Arbi) -> Option<Ordering>

This method returns an ordering between self and other values if one exists. Read more
1.0.0 · Source§

fn lt(&self, other: &Rhs) -> bool

Tests less than (for self and other) and is used by the < operator. Read more
1.0.0 · Source§

fn le(&self, other: &Rhs) -> bool

Tests less than or equal to (for self and other) and is used by the <= operator. Read more
1.0.0 · Source§

fn gt(&self, other: &Rhs) -> bool

Tests greater than (for self and other) and is used by the > operator. Read more
1.0.0 · Source§

fn ge(&self, other: &Rhs) -> bool

Tests greater than or equal to (for self and other) and is used by the >= operator. Read more
Source§

impl PartialOrd<Arbi> for usize

Compare the value of this primitive integer value to an Arbi integer.

This is implemented for all primitive integer types.

§Examples

use arbi::Arbi;

let a = Arbi::from(u64::MAX);
assert!(0 < a);
assert!(u128::MAX > a);
assert!(0 <= a);
assert!(u128::MAX >= a);
§Complexity

\( O(1) \)

Source§

fn partial_cmp(&self, other: &Arbi) -> Option<Ordering>

This method returns an ordering between self and other values if one exists. Read more
1.0.0 · Source§

fn lt(&self, other: &Rhs) -> bool

Tests less than (for self and other) and is used by the < operator. Read more
1.0.0 · Source§

fn le(&self, other: &Rhs) -> bool

Tests less than or equal to (for self and other) and is used by the <= operator. Read more
1.0.0 · Source§

fn gt(&self, other: &Rhs) -> bool

Tests greater than (for self and other) and is used by the > operator. Read more
1.0.0 · Source§

fn ge(&self, other: &Rhs) -> bool

Tests greater than or equal to (for self and other) and is used by the >= operator. Read more
Source§

impl PartialOrd<f64> for &Arbi

Source§

fn partial_cmp(&self, other: &f64) -> Option<Ordering>

This method returns an ordering between self and other values if one exists. Read more
1.0.0 · Source§

fn lt(&self, other: &Rhs) -> bool

Tests less than (for self and other) and is used by the < operator. Read more
1.0.0 · Source§

fn le(&self, other: &Rhs) -> bool

Tests less than or equal to (for self and other) and is used by the <= operator. Read more
1.0.0 · Source§

fn gt(&self, other: &Rhs) -> bool

Tests greater than (for self and other) and is used by the > operator. Read more
1.0.0 · Source§

fn ge(&self, other: &Rhs) -> bool

Tests greater than or equal to (for self and other) and is used by the >= operator. Read more
Source§

impl PartialOrd<f64> for Arbi

Compare this Arbi integer to a floating-point value.

These comparisons are designed to be consistent with IEEE 754, handling special cases like NaNs and infinities.

NaN:

  • Operators ==, <, <=, >, and >= return false when comparing with NaN.
  • Operator != returns true when comparing with NaN.

Infinities:

  • Positive infinity is treated as greater than any Arbi number.
  • Negative infinity is treated as less than any Arbi number.

§Examples

use arbi::Arbi;

let a = Arbi::from(987654321.5);
assert_eq!(a, 987654321.0);

assert!(a >= 987654321.0);
assert!(a <= 987654321.0);
assert!(a > 0.0);
assert!(a < u64::MAX);

// Reverse also implemented
assert!(987654321.0 <= a);
assert!(987654321.0 >= a);
assert!(0.0 < a);
assert!(u64::MAX > a);
§Complexity

\( O(1) \)

Source§

fn partial_cmp(&self, other: &f64) -> Option<Ordering>

This method returns an ordering between self and other values if one exists. Read more
1.0.0 · Source§

fn lt(&self, other: &Rhs) -> bool

Tests less than (for self and other) and is used by the < operator. Read more
1.0.0 · Source§

fn le(&self, other: &Rhs) -> bool

Tests less than or equal to (for self and other) and is used by the <= operator. Read more
1.0.0 · Source§

fn gt(&self, other: &Rhs) -> bool

Tests greater than (for self and other) and is used by the > operator. Read more
1.0.0 · Source§

fn ge(&self, other: &Rhs) -> bool

Tests greater than or equal to (for self and other) and is used by the >= operator. Read more
Source§

impl PartialOrd<i128> for &Arbi

Source§

fn partial_cmp(&self, other: &i128) -> Option<Ordering>

This method returns an ordering between self and other values if one exists. Read more
1.0.0 · Source§

fn lt(&self, other: &Rhs) -> bool

Tests less than (for self and other) and is used by the < operator. Read more
1.0.0 · Source§

fn le(&self, other: &Rhs) -> bool

Tests less than or equal to (for self and other) and is used by the <= operator. Read more
1.0.0 · Source§

fn gt(&self, other: &Rhs) -> bool

Tests greater than (for self and other) and is used by the > operator. Read more
1.0.0 · Source§

fn ge(&self, other: &Rhs) -> bool

Tests greater than or equal to (for self and other) and is used by the >= operator. Read more
Source§

impl PartialOrd<i128> for &mut Arbi

Source§

fn partial_cmp(&self, other: &i128) -> Option<Ordering>

This method returns an ordering between self and other values if one exists. Read more
1.0.0 · Source§

fn lt(&self, other: &Rhs) -> bool

Tests less than (for self and other) and is used by the < operator. Read more
1.0.0 · Source§

fn le(&self, other: &Rhs) -> bool

Tests less than or equal to (for self and other) and is used by the <= operator. Read more
1.0.0 · Source§

fn gt(&self, other: &Rhs) -> bool

Tests greater than (for self and other) and is used by the > operator. Read more
1.0.0 · Source§

fn ge(&self, other: &Rhs) -> bool

Tests greater than or equal to (for self and other) and is used by the >= operator. Read more
Source§

impl PartialOrd<i128> for Arbi

Compare the value of this Arbi integer to a primitive integer value.

This is implemented for all primitive integer types.

§Examples

use arbi::Arbi;

let a = Arbi::from(u64::MAX);
assert!(a > 0);
assert!(a < u128::MAX);
assert!(a >= 0);
assert!(a <= u128::MAX);
§Complexity

\( O(1) \)

Source§

fn partial_cmp(&self, other: &i128) -> Option<Ordering>

This method returns an ordering between self and other values if one exists. Read more
1.0.0 · Source§

fn lt(&self, other: &Rhs) -> bool

Tests less than (for self and other) and is used by the < operator. Read more
1.0.0 · Source§

fn le(&self, other: &Rhs) -> bool

Tests less than or equal to (for self and other) and is used by the <= operator. Read more
1.0.0 · Source§

fn gt(&self, other: &Rhs) -> bool

Tests greater than (for self and other) and is used by the > operator. Read more
1.0.0 · Source§

fn ge(&self, other: &Rhs) -> bool

Tests greater than or equal to (for self and other) and is used by the >= operator. Read more
Source§

impl PartialOrd<i16> for &Arbi

Source§

fn partial_cmp(&self, other: &i16) -> Option<Ordering>

This method returns an ordering between self and other values if one exists. Read more
1.0.0 · Source§

fn lt(&self, other: &Rhs) -> bool

Tests less than (for self and other) and is used by the < operator. Read more
1.0.0 · Source§

fn le(&self, other: &Rhs) -> bool

Tests less than or equal to (for self and other) and is used by the <= operator. Read more
1.0.0 · Source§

fn gt(&self, other: &Rhs) -> bool

Tests greater than (for self and other) and is used by the > operator. Read more
1.0.0 · Source§

fn ge(&self, other: &Rhs) -> bool

Tests greater than or equal to (for self and other) and is used by the >= operator. Read more
Source§

impl PartialOrd<i16> for &mut Arbi

Source§

fn partial_cmp(&self, other: &i16) -> Option<Ordering>

This method returns an ordering between self and other values if one exists. Read more
1.0.0 · Source§

fn lt(&self, other: &Rhs) -> bool

Tests less than (for self and other) and is used by the < operator. Read more
1.0.0 · Source§

fn le(&self, other: &Rhs) -> bool

Tests less than or equal to (for self and other) and is used by the <= operator. Read more
1.0.0 · Source§

fn gt(&self, other: &Rhs) -> bool

Tests greater than (for self and other) and is used by the > operator. Read more
1.0.0 · Source§

fn ge(&self, other: &Rhs) -> bool

Tests greater than or equal to (for self and other) and is used by the >= operator. Read more
Source§

impl PartialOrd<i16> for Arbi

Compare the value of this Arbi integer to a primitive integer value.

This is implemented for all primitive integer types.

§Examples

use arbi::Arbi;

let a = Arbi::from(u64::MAX);
assert!(a > 0);
assert!(a < u128::MAX);
assert!(a >= 0);
assert!(a <= u128::MAX);
§Complexity

\( O(1) \)

Source§

fn partial_cmp(&self, other: &i16) -> Option<Ordering>

This method returns an ordering between self and other values if one exists. Read more
1.0.0 · Source§

fn lt(&self, other: &Rhs) -> bool

Tests less than (for self and other) and is used by the < operator. Read more
1.0.0 · Source§

fn le(&self, other: &Rhs) -> bool

Tests less than or equal to (for self and other) and is used by the <= operator. Read more
1.0.0 · Source§

fn gt(&self, other: &Rhs) -> bool

Tests greater than (for self and other) and is used by the > operator. Read more
1.0.0 · Source§

fn ge(&self, other: &Rhs) -> bool

Tests greater than or equal to (for self and other) and is used by the >= operator. Read more
Source§

impl PartialOrd<i32> for &Arbi

Source§

fn partial_cmp(&self, other: &i32) -> Option<Ordering>

This method returns an ordering between self and other values if one exists. Read more
1.0.0 · Source§

fn lt(&self, other: &Rhs) -> bool

Tests less than (for self and other) and is used by the < operator. Read more
1.0.0 · Source§

fn le(&self, other: &Rhs) -> bool

Tests less than or equal to (for self and other) and is used by the <= operator. Read more
1.0.0 · Source§

fn gt(&self, other: &Rhs) -> bool

Tests greater than (for self and other) and is used by the > operator. Read more
1.0.0 · Source§

fn ge(&self, other: &Rhs) -> bool

Tests greater than or equal to (for self and other) and is used by the >= operator. Read more
Source§

impl PartialOrd<i32> for &mut Arbi

Source§

fn partial_cmp(&self, other: &i32) -> Option<Ordering>

This method returns an ordering between self and other values if one exists. Read more
1.0.0 · Source§

fn lt(&self, other: &Rhs) -> bool

Tests less than (for self and other) and is used by the < operator. Read more
1.0.0 · Source§

fn le(&self, other: &Rhs) -> bool

Tests less than or equal to (for self and other) and is used by the <= operator. Read more
1.0.0 · Source§

fn gt(&self, other: &Rhs) -> bool

Tests greater than (for self and other) and is used by the > operator. Read more
1.0.0 · Source§

fn ge(&self, other: &Rhs) -> bool

Tests greater than or equal to (for self and other) and is used by the >= operator. Read more
Source§

impl PartialOrd<i32> for Arbi

Compare the value of this Arbi integer to a primitive integer value.

This is implemented for all primitive integer types.

§Examples

use arbi::Arbi;

let a = Arbi::from(u64::MAX);
assert!(a > 0);
assert!(a < u128::MAX);
assert!(a >= 0);
assert!(a <= u128::MAX);
§Complexity

\( O(1) \)

Source§

fn partial_cmp(&self, other: &i32) -> Option<Ordering>

This method returns an ordering between self and other values if one exists. Read more
1.0.0 · Source§

fn lt(&self, other: &Rhs) -> bool

Tests less than (for self and other) and is used by the < operator. Read more
1.0.0 · Source§

fn le(&self, other: &Rhs) -> bool

Tests less than or equal to (for self and other) and is used by the <= operator. Read more
1.0.0 · Source§

fn gt(&self, other: &Rhs) -> bool

Tests greater than (for self and other) and is used by the > operator. Read more
1.0.0 · Source§

fn ge(&self, other: &Rhs) -> bool

Tests greater than or equal to (for self and other) and is used by the >= operator. Read more
Source§

impl PartialOrd<i64> for &Arbi

Source§

fn partial_cmp(&self, other: &i64) -> Option<Ordering>

This method returns an ordering between self and other values if one exists. Read more
1.0.0 · Source§

fn lt(&self, other: &Rhs) -> bool

Tests less than (for self and other) and is used by the < operator. Read more
1.0.0 · Source§

fn le(&self, other: &Rhs) -> bool

Tests less than or equal to (for self and other) and is used by the <= operator. Read more
1.0.0 · Source§

fn gt(&self, other: &Rhs) -> bool

Tests greater than (for self and other) and is used by the > operator. Read more
1.0.0 · Source§

fn ge(&self, other: &Rhs) -> bool

Tests greater than or equal to (for self and other) and is used by the >= operator. Read more
Source§

impl PartialOrd<i64> for &mut Arbi

Source§

fn partial_cmp(&self, other: &i64) -> Option<Ordering>

This method returns an ordering between self and other values if one exists. Read more
1.0.0 · Source§

fn lt(&self, other: &Rhs) -> bool

Tests less than (for self and other) and is used by the < operator. Read more
1.0.0 · Source§

fn le(&self, other: &Rhs) -> bool

Tests less than or equal to (for self and other) and is used by the <= operator. Read more
1.0.0 · Source§

fn gt(&self, other: &Rhs) -> bool

Tests greater than (for self and other) and is used by the > operator. Read more
1.0.0 · Source§

fn ge(&self, other: &Rhs) -> bool

Tests greater than or equal to (for self and other) and is used by the >= operator. Read more
Source§

impl PartialOrd<i64> for Arbi

Compare the value of this Arbi integer to a primitive integer value.

This is implemented for all primitive integer types.

§Examples

use arbi::Arbi;

let a = Arbi::from(u64::MAX);
assert!(a > 0);
assert!(a < u128::MAX);
assert!(a >= 0);
assert!(a <= u128::MAX);
§Complexity

\( O(1) \)

Source§

fn partial_cmp(&self, other: &i64) -> Option<Ordering>

This method returns an ordering between self and other values if one exists. Read more
1.0.0 · Source§

fn lt(&self, other: &Rhs) -> bool

Tests less than (for self and other) and is used by the < operator. Read more
1.0.0 · Source§

fn le(&self, other: &Rhs) -> bool

Tests less than or equal to (for self and other) and is used by the <= operator. Read more
1.0.0 · Source§

fn gt(&self, other: &Rhs) -> bool

Tests greater than (for self and other) and is used by the > operator. Read more
1.0.0 · Source§

fn ge(&self, other: &Rhs) -> bool

Tests greater than or equal to (for self and other) and is used by the >= operator. Read more
Source§

impl PartialOrd<i8> for &Arbi

Source§

fn partial_cmp(&self, other: &i8) -> Option<Ordering>

This method returns an ordering between self and other values if one exists. Read more
1.0.0 · Source§

fn lt(&self, other: &Rhs) -> bool

Tests less than (for self and other) and is used by the < operator. Read more
1.0.0 · Source§

fn le(&self, other: &Rhs) -> bool

Tests less than or equal to (for self and other) and is used by the <= operator. Read more
1.0.0 · Source§

fn gt(&self, other: &Rhs) -> bool

Tests greater than (for self and other) and is used by the > operator. Read more
1.0.0 · Source§

fn ge(&self, other: &Rhs) -> bool

Tests greater than or equal to (for self and other) and is used by the >= operator. Read more
Source§

impl PartialOrd<i8> for &mut Arbi

Source§

fn partial_cmp(&self, other: &i8) -> Option<Ordering>

This method returns an ordering between self and other values if one exists. Read more
1.0.0 · Source§

fn lt(&self, other: &Rhs) -> bool

Tests less than (for self and other) and is used by the < operator. Read more
1.0.0 · Source§

fn le(&self, other: &Rhs) -> bool

Tests less than or equal to (for self and other) and is used by the <= operator. Read more
1.0.0 · Source§

fn gt(&self, other: &Rhs) -> bool

Tests greater than (for self and other) and is used by the > operator. Read more
1.0.0 · Source§

fn ge(&self, other: &Rhs) -> bool

Tests greater than or equal to (for self and other) and is used by the >= operator. Read more
Source§

impl PartialOrd<i8> for Arbi

Compare the value of this Arbi integer to a primitive integer value.

This is implemented for all primitive integer types.

§Examples

use arbi::Arbi;

let a = Arbi::from(u64::MAX);
assert!(a > 0);
assert!(a < u128::MAX);
assert!(a >= 0);
assert!(a <= u128::MAX);
§Complexity

\( O(1) \)

Source§

fn partial_cmp(&self, other: &i8) -> Option<Ordering>

This method returns an ordering between self and other values if one exists. Read more
1.0.0 · Source§

fn lt(&self, other: &Rhs) -> bool

Tests less than (for self and other) and is used by the < operator. Read more
1.0.0 · Source§

fn le(&self, other: &Rhs) -> bool

Tests less than or equal to (for self and other) and is used by the <= operator. Read more
1.0.0 · Source§

fn gt(&self, other: &Rhs) -> bool

Tests greater than (for self and other) and is used by the > operator. Read more
1.0.0 · Source§

fn ge(&self, other: &Rhs) -> bool

Tests greater than or equal to (for self and other) and is used by the >= operator. Read more
Source§

impl PartialOrd<isize> for &Arbi

Source§

fn partial_cmp(&self, other: &isize) -> Option<Ordering>

This method returns an ordering between self and other values if one exists. Read more
1.0.0 · Source§

fn lt(&self, other: &Rhs) -> bool

Tests less than (for self and other) and is used by the < operator. Read more
1.0.0 · Source§

fn le(&self, other: &Rhs) -> bool

Tests less than or equal to (for self and other) and is used by the <= operator. Read more
1.0.0 · Source§

fn gt(&self, other: &Rhs) -> bool

Tests greater than (for self and other) and is used by the > operator. Read more
1.0.0 · Source§

fn ge(&self, other: &Rhs) -> bool

Tests greater than or equal to (for self and other) and is used by the >= operator. Read more
Source§

impl PartialOrd<isize> for &mut Arbi

Source§

fn partial_cmp(&self, other: &isize) -> Option<Ordering>

This method returns an ordering between self and other values if one exists. Read more
1.0.0 · Source§

fn lt(&self, other: &Rhs) -> bool

Tests less than (for self and other) and is used by the < operator. Read more
1.0.0 · Source§

fn le(&self, other: &Rhs) -> bool

Tests less than or equal to (for self and other) and is used by the <= operator. Read more
1.0.0 · Source§

fn gt(&self, other: &Rhs) -> bool

Tests greater than (for self and other) and is used by the > operator. Read more
1.0.0 · Source§

fn ge(&self, other: &Rhs) -> bool

Tests greater than or equal to (for self and other) and is used by the >= operator. Read more
Source§

impl PartialOrd<isize> for Arbi

Compare the value of this Arbi integer to a primitive integer value.

This is implemented for all primitive integer types.

§Examples

use arbi::Arbi;

let a = Arbi::from(u64::MAX);
assert!(a > 0);
assert!(a < u128::MAX);
assert!(a >= 0);
assert!(a <= u128::MAX);
§Complexity

\( O(1) \)

Source§

fn partial_cmp(&self, other: &isize) -> Option<Ordering>

This method returns an ordering between self and other values if one exists. Read more
1.0.0 · Source§

fn lt(&self, other: &Rhs) -> bool

Tests less than (for self and other) and is used by the < operator. Read more
1.0.0 · Source§

fn le(&self, other: &Rhs) -> bool

Tests less than or equal to (for self and other) and is used by the <= operator. Read more
1.0.0 · Source§

fn gt(&self, other: &Rhs) -> bool

Tests greater than (for self and other) and is used by the > operator. Read more
1.0.0 · Source§

fn ge(&self, other: &Rhs) -> bool

Tests greater than or equal to (for self and other) and is used by the >= operator. Read more
Source§

impl PartialOrd<u128> for &Arbi

Source§

fn partial_cmp(&self, other: &u128) -> Option<Ordering>

This method returns an ordering between self and other values if one exists. Read more
1.0.0 · Source§

fn lt(&self, other: &Rhs) -> bool

Tests less than (for self and other) and is used by the < operator. Read more
1.0.0 · Source§

fn le(&self, other: &Rhs) -> bool

Tests less than or equal to (for self and other) and is used by the <= operator. Read more
1.0.0 · Source§

fn gt(&self, other: &Rhs) -> bool

Tests greater than (for self and other) and is used by the > operator. Read more
1.0.0 · Source§

fn ge(&self, other: &Rhs) -> bool

Tests greater than or equal to (for self and other) and is used by the >= operator. Read more
Source§

impl PartialOrd<u128> for &mut Arbi

Source§

fn partial_cmp(&self, other: &u128) -> Option<Ordering>

This method returns an ordering between self and other values if one exists. Read more
1.0.0 · Source§

fn lt(&self, other: &Rhs) -> bool

Tests less than (for self and other) and is used by the < operator. Read more
1.0.0 · Source§

fn le(&self, other: &Rhs) -> bool

Tests less than or equal to (for self and other) and is used by the <= operator. Read more
1.0.0 · Source§

fn gt(&self, other: &Rhs) -> bool

Tests greater than (for self and other) and is used by the > operator. Read more
1.0.0 · Source§

fn ge(&self, other: &Rhs) -> bool

Tests greater than or equal to (for self and other) and is used by the >= operator. Read more
Source§

impl PartialOrd<u128> for Arbi

Compare the value of this Arbi integer to a primitive integer value.

This is implemented for all primitive integer types.

§Examples

use arbi::Arbi;

let a = Arbi::from(u64::MAX);
assert!(a > 0);
assert!(a < u128::MAX);
assert!(a >= 0);
assert!(a <= u128::MAX);
§Complexity

\( O(1) \)

Source§

fn partial_cmp(&self, other: &u128) -> Option<Ordering>

This method returns an ordering between self and other values if one exists. Read more
1.0.0 · Source§

fn lt(&self, other: &Rhs) -> bool

Tests less than (for self and other) and is used by the < operator. Read more
1.0.0 · Source§

fn le(&self, other: &Rhs) -> bool

Tests less than or equal to (for self and other) and is used by the <= operator. Read more
1.0.0 · Source§

fn gt(&self, other: &Rhs) -> bool

Tests greater than (for self and other) and is used by the > operator. Read more
1.0.0 · Source§

fn ge(&self, other: &Rhs) -> bool

Tests greater than or equal to (for self and other) and is used by the >= operator. Read more
Source§

impl PartialOrd<u16> for &Arbi

Source§

fn partial_cmp(&self, other: &u16) -> Option<Ordering>

This method returns an ordering between self and other values if one exists. Read more
1.0.0 · Source§

fn lt(&self, other: &Rhs) -> bool

Tests less than (for self and other) and is used by the < operator. Read more
1.0.0 · Source§

fn le(&self, other: &Rhs) -> bool

Tests less than or equal to (for self and other) and is used by the <= operator. Read more
1.0.0 · Source§

fn gt(&self, other: &Rhs) -> bool

Tests greater than (for self and other) and is used by the > operator. Read more
1.0.0 · Source§

fn ge(&self, other: &Rhs) -> bool

Tests greater than or equal to (for self and other) and is used by the >= operator. Read more
Source§

impl PartialOrd<u16> for &mut Arbi

Source§

fn partial_cmp(&self, other: &u16) -> Option<Ordering>

This method returns an ordering between self and other values if one exists. Read more
1.0.0 · Source§

fn lt(&self, other: &Rhs) -> bool

Tests less than (for self and other) and is used by the < operator. Read more
1.0.0 · Source§

fn le(&self, other: &Rhs) -> bool

Tests less than or equal to (for self and other) and is used by the <= operator. Read more
1.0.0 · Source§

fn gt(&self, other: &Rhs) -> bool

Tests greater than (for self and other) and is used by the > operator. Read more
1.0.0 · Source§

fn ge(&self, other: &Rhs) -> bool

Tests greater than or equal to (for self and other) and is used by the >= operator. Read more
Source§

impl PartialOrd<u16> for Arbi

Compare the value of this Arbi integer to a primitive integer value.

This is implemented for all primitive integer types.

§Examples

use arbi::Arbi;

let a = Arbi::from(u64::MAX);
assert!(a > 0);
assert!(a < u128::MAX);
assert!(a >= 0);
assert!(a <= u128::MAX);
§Complexity

\( O(1) \)

Source§

fn partial_cmp(&self, other: &u16) -> Option<Ordering>

This method returns an ordering between self and other values if one exists. Read more
1.0.0 · Source§

fn lt(&self, other: &Rhs) -> bool

Tests less than (for self and other) and is used by the < operator. Read more
1.0.0 · Source§

fn le(&self, other: &Rhs) -> bool

Tests less than or equal to (for self and other) and is used by the <= operator. Read more
1.0.0 · Source§

fn gt(&self, other: &Rhs) -> bool

Tests greater than (for self and other) and is used by the > operator. Read more
1.0.0 · Source§

fn ge(&self, other: &Rhs) -> bool

Tests greater than or equal to (for self and other) and is used by the >= operator. Read more
Source§

impl PartialOrd<u32> for &Arbi

Source§

fn partial_cmp(&self, other: &u32) -> Option<Ordering>

This method returns an ordering between self and other values if one exists. Read more
1.0.0 · Source§

fn lt(&self, other: &Rhs) -> bool

Tests less than (for self and other) and is used by the < operator. Read more
1.0.0 · Source§

fn le(&self, other: &Rhs) -> bool

Tests less than or equal to (for self and other) and is used by the <= operator. Read more
1.0.0 · Source§

fn gt(&self, other: &Rhs) -> bool

Tests greater than (for self and other) and is used by the > operator. Read more
1.0.0 · Source§

fn ge(&self, other: &Rhs) -> bool

Tests greater than or equal to (for self and other) and is used by the >= operator. Read more
Source§

impl PartialOrd<u32> for &mut Arbi

Source§

fn partial_cmp(&self, other: &u32) -> Option<Ordering>

This method returns an ordering between self and other values if one exists. Read more
1.0.0 · Source§

fn lt(&self, other: &Rhs) -> bool

Tests less than (for self and other) and is used by the < operator. Read more
1.0.0 · Source§

fn le(&self, other: &Rhs) -> bool

Tests less than or equal to (for self and other) and is used by the <= operator. Read more
1.0.0 · Source§

fn gt(&self, other: &Rhs) -> bool

Tests greater than (for self and other) and is used by the > operator. Read more
1.0.0 · Source§

fn ge(&self, other: &Rhs) -> bool

Tests greater than or equal to (for self and other) and is used by the >= operator. Read more
Source§

impl PartialOrd<u32> for Arbi

Compare the value of this Arbi integer to a primitive integer value.

This is implemented for all primitive integer types.

§Examples

use arbi::Arbi;

let a = Arbi::from(u64::MAX);
assert!(a > 0);
assert!(a < u128::MAX);
assert!(a >= 0);
assert!(a <= u128::MAX);
§Complexity

\( O(1) \)

Source§

fn partial_cmp(&self, other: &u32) -> Option<Ordering>

This method returns an ordering between self and other values if one exists. Read more
1.0.0 · Source§

fn lt(&self, other: &Rhs) -> bool

Tests less than (for self and other) and is used by the < operator. Read more
1.0.0 · Source§

fn le(&self, other: &Rhs) -> bool

Tests less than or equal to (for self and other) and is used by the <= operator. Read more
1.0.0 · Source§

fn gt(&self, other: &Rhs) -> bool

Tests greater than (for self and other) and is used by the > operator. Read more
1.0.0 · Source§

fn ge(&self, other: &Rhs) -> bool

Tests greater than or equal to (for self and other) and is used by the >= operator. Read more
Source§

impl PartialOrd<u64> for &Arbi

Source§

fn partial_cmp(&self, other: &u64) -> Option<Ordering>

This method returns an ordering between self and other values if one exists. Read more
1.0.0 · Source§

fn lt(&self, other: &Rhs) -> bool

Tests less than (for self and other) and is used by the < operator. Read more
1.0.0 · Source§

fn le(&self, other: &Rhs) -> bool

Tests less than or equal to (for self and other) and is used by the <= operator. Read more
1.0.0 · Source§

fn gt(&self, other: &Rhs) -> bool

Tests greater than (for self and other) and is used by the > operator. Read more
1.0.0 · Source§

fn ge(&self, other: &Rhs) -> bool

Tests greater than or equal to (for self and other) and is used by the >= operator. Read more
Source§

impl PartialOrd<u64> for &mut Arbi

Source§

fn partial_cmp(&self, other: &u64) -> Option<Ordering>

This method returns an ordering between self and other values if one exists. Read more
1.0.0 · Source§

fn lt(&self, other: &Rhs) -> bool

Tests less than (for self and other) and is used by the < operator. Read more
1.0.0 · Source§

fn le(&self, other: &Rhs) -> bool

Tests less than or equal to (for self and other) and is used by the <= operator. Read more
1.0.0 · Source§

fn gt(&self, other: &Rhs) -> bool

Tests greater than (for self and other) and is used by the > operator. Read more
1.0.0 · Source§

fn ge(&self, other: &Rhs) -> bool

Tests greater than or equal to (for self and other) and is used by the >= operator. Read more
Source§

impl PartialOrd<u64> for Arbi

Compare the value of this Arbi integer to a primitive integer value.

This is implemented for all primitive integer types.

§Examples

use arbi::Arbi;

let a = Arbi::from(u64::MAX);
assert!(a > 0);
assert!(a < u128::MAX);
assert!(a >= 0);
assert!(a <= u128::MAX);
§Complexity

\( O(1) \)

Source§

fn partial_cmp(&self, other: &u64) -> Option<Ordering>

This method returns an ordering between self and other values if one exists. Read more
1.0.0 · Source§

fn lt(&self, other: &Rhs) -> bool

Tests less than (for self and other) and is used by the < operator. Read more
1.0.0 · Source§

fn le(&self, other: &Rhs) -> bool

Tests less than or equal to (for self and other) and is used by the <= operator. Read more
1.0.0 · Source§

fn gt(&self, other: &Rhs) -> bool

Tests greater than (for self and other) and is used by the > operator. Read more
1.0.0 · Source§

fn ge(&self, other: &Rhs) -> bool

Tests greater than or equal to (for self and other) and is used by the >= operator. Read more
Source§

impl PartialOrd<u8> for &Arbi

Source§

fn partial_cmp(&self, other: &u8) -> Option<Ordering>

This method returns an ordering between self and other values if one exists. Read more
1.0.0 · Source§

fn lt(&self, other: &Rhs) -> bool

Tests less than (for self and other) and is used by the < operator. Read more
1.0.0 · Source§

fn le(&self, other: &Rhs) -> bool

Tests less than or equal to (for self and other) and is used by the <= operator. Read more
1.0.0 · Source§

fn gt(&self, other: &Rhs) -> bool

Tests greater than (for self and other) and is used by the > operator. Read more
1.0.0 · Source§

fn ge(&self, other: &Rhs) -> bool

Tests greater than or equal to (for self and other) and is used by the >= operator. Read more
Source§

impl PartialOrd<u8> for &mut Arbi

Source§

fn partial_cmp(&self, other: &u8) -> Option<Ordering>

This method returns an ordering between self and other values if one exists. Read more
1.0.0 · Source§

fn lt(&self, other: &Rhs) -> bool

Tests less than (for self and other) and is used by the < operator. Read more
1.0.0 · Source§

fn le(&self, other: &Rhs) -> bool

Tests less than or equal to (for self and other) and is used by the <= operator. Read more
1.0.0 · Source§

fn gt(&self, other: &Rhs) -> bool

Tests greater than (for self and other) and is used by the > operator. Read more
1.0.0 · Source§

fn ge(&self, other: &Rhs) -> bool

Tests greater than or equal to (for self and other) and is used by the >= operator. Read more
Source§

impl PartialOrd<u8> for Arbi

Compare the value of this Arbi integer to a primitive integer value.

This is implemented for all primitive integer types.

§Examples

use arbi::Arbi;

let a = Arbi::from(u64::MAX);
assert!(a > 0);
assert!(a < u128::MAX);
assert!(a >= 0);
assert!(a <= u128::MAX);
§Complexity

\( O(1) \)

Source§

fn partial_cmp(&self, other: &u8) -> Option<Ordering>

This method returns an ordering between self and other values if one exists. Read more
1.0.0 · Source§

fn lt(&self, other: &Rhs) -> bool

Tests less than (for self and other) and is used by the < operator. Read more
1.0.0 · Source§

fn le(&self, other: &Rhs) -> bool

Tests less than or equal to (for self and other) and is used by the <= operator. Read more
1.0.0 · Source§

fn gt(&self, other: &Rhs) -> bool

Tests greater than (for self and other) and is used by the > operator. Read more
1.0.0 · Source§

fn ge(&self, other: &Rhs) -> bool

Tests greater than or equal to (for self and other) and is used by the >= operator. Read more
Source§

impl PartialOrd<usize> for &Arbi

Source§

fn partial_cmp(&self, other: &usize) -> Option<Ordering>

This method returns an ordering between self and other values if one exists. Read more
1.0.0 · Source§

fn lt(&self, other: &Rhs) -> bool

Tests less than (for self and other) and is used by the < operator. Read more
1.0.0 · Source§

fn le(&self, other: &Rhs) -> bool

Tests less than or equal to (for self and other) and is used by the <= operator. Read more
1.0.0 · Source§

fn gt(&self, other: &Rhs) -> bool

Tests greater than (for self and other) and is used by the > operator. Read more
1.0.0 · Source§

fn ge(&self, other: &Rhs) -> bool

Tests greater than or equal to (for self and other) and is used by the >= operator. Read more
Source§

impl PartialOrd<usize> for &mut Arbi

Source§

fn partial_cmp(&self, other: &usize) -> Option<Ordering>

This method returns an ordering between self and other values if one exists. Read more
1.0.0 · Source§

fn lt(&self, other: &Rhs) -> bool

Tests less than (for self and other) and is used by the < operator. Read more
1.0.0 · Source§

fn le(&self, other: &Rhs) -> bool

Tests less than or equal to (for self and other) and is used by the <= operator. Read more
1.0.0 · Source§

fn gt(&self, other: &Rhs) -> bool

Tests greater than (for self and other) and is used by the > operator. Read more
1.0.0 · Source§

fn ge(&self, other: &Rhs) -> bool

Tests greater than or equal to (for self and other) and is used by the >= operator. Read more
Source§

impl PartialOrd<usize> for Arbi

Compare the value of this Arbi integer to a primitive integer value.

This is implemented for all primitive integer types.

§Examples

use arbi::Arbi;

let a = Arbi::from(u64::MAX);
assert!(a > 0);
assert!(a < u128::MAX);
assert!(a >= 0);
assert!(a <= u128::MAX);
§Complexity

\( O(1) \)

Source§

fn partial_cmp(&self, other: &usize) -> Option<Ordering>

This method returns an ordering between self and other values if one exists. Read more
1.0.0 · Source§

fn lt(&self, other: &Rhs) -> bool

Tests less than (for self and other) and is used by the < operator. Read more
1.0.0 · Source§

fn le(&self, other: &Rhs) -> bool

Tests less than or equal to (for self and other) and is used by the <= operator. Read more
1.0.0 · Source§

fn gt(&self, other: &Rhs) -> bool

Tests greater than (for self and other) and is used by the > operator. Read more
1.0.0 · Source§

fn ge(&self, other: &Rhs) -> bool

Tests greater than or equal to (for self and other) and is used by the >= operator. Read more
Source§

impl PartialOrd for Arbi

Source§

fn partial_cmp(&self, other: &Self) -> Option<Ordering>

This method returns an ordering between self and other values if one exists. Read more
1.0.0 · Source§

fn lt(&self, other: &Rhs) -> bool

Tests less than (for self and other) and is used by the < operator. Read more
1.0.0 · Source§

fn le(&self, other: &Rhs) -> bool

Tests less than or equal to (for self and other) and is used by the <= operator. Read more
1.0.0 · Source§

fn gt(&self, other: &Rhs) -> bool

Tests greater than (for self and other) and is used by the > operator. Read more
1.0.0 · Source§

fn ge(&self, other: &Rhs) -> bool

Tests greater than or equal to (for self and other) and is used by the >= operator. Read more
Source§

impl<'a> Pow<&'a Arbi> for &Arbi

Source§

type Output = Arbi

Source§

fn pow(self, exp: &'a Arbi) -> Arbi

Source§

impl<'a> Pow<&'a Arbi> for Arbi

Source§

type Output = Arbi

Source§

fn pow(self, exp: &'a Arbi) -> Arbi

Source§

impl Pow<&u128> for &Arbi

Source§

type Output = Arbi

Source§

fn pow(self, exp: &u128) -> Arbi

Source§

impl Pow<&u128> for Arbi

Source§

type Output = Arbi

Source§

fn pow(self, exp: &u128) -> Arbi

Source§

impl<'a> Pow<&'a usize> for &Arbi

Source§

type Output = Arbi

Source§

fn pow(self, exp: &'a usize) -> Arbi

Source§

impl<'a> Pow<&'a usize> for Arbi

Source§

type Output = Arbi

Source§

fn pow(self, exp: &'a usize) -> Arbi

Source§

impl Pow<Arbi> for &Arbi

Source§

type Output = Arbi

Source§

fn pow(self, exp: Arbi) -> Arbi

Source§

impl Pow<Arbi> for Arbi

Source§

type Output = Arbi

Source§

fn pow(self, exp: Arbi) -> Arbi

Source§

impl Pow<u128> for &Arbi

Source§

type Output = Arbi

Source§

fn pow(self, exp: u128) -> Arbi

Source§

impl Pow<u128> for Arbi

Source§

type Output = Arbi

Source§

fn pow(self, exp: u128) -> Arbi

Source§

impl Pow<usize> for &Arbi

Source§

type Output = Arbi

Source§

fn pow(self, exp: usize) -> Arbi

Source§

impl Pow<usize> for Arbi

Source§

type Output = Arbi

Source§

fn pow(self, exp: usize) -> Arbi

Source§

impl<'a> Rem<&'a Arbi> for &Arbi

See the div() method.

Source§

type Output = Arbi

The resulting type after applying the % operator.
Source§

fn rem(self, rhs: &'a Arbi) -> Arbi

Performs the % operation. Read more
Source§

impl<'a> Rem<&'a Arbi> for Arbi

See the div() method.

Source§

type Output = Arbi

The resulting type after applying the % operator.
Source§

fn rem(self, rhs: &'a Arbi) -> Arbi

Performs the % operation. Read more
Source§

impl Rem for Arbi

See the div() method.

Source§

type Output = Arbi

The resulting type after applying the % operator.
Source§

fn rem(self, rhs: Arbi) -> Arbi

Performs the % operation. Read more
Source§

impl<'a> RemAssign<&'a Arbi> for Arbi

See the div() method.

Source§

fn rem_assign(&mut self, rhs: &'a Arbi)

Performs the %= operation. Read more
Source§

impl RemAssign for Arbi

See the div() method.

Source§

fn rem_assign(&mut self, rhs: Arbi)

Performs the %= operation. Read more
Source§

impl<'a> Shl<&'a u32> for Arbi

Source§

type Output = Arbi

The resulting type after applying the << operator.
Source§

fn shl(self, rhs: &'a u32) -> Arbi

Performs the << operation. Read more
Source§

impl<'a> Shl<&'a usize> for Arbi

Source§

type Output = Arbi

The resulting type after applying the << operator.
Source§

fn shl(self, rhs: &'a usize) -> Arbi

Performs the << operation. Read more
Source§

impl Shl<u32> for &Arbi

Return an Arbi integer representing this integer left-shifted shift bit positions with vacated bits zero-filled.

Mathematically, the value of the resulting integer is \[ x \times 2^{\text{shift}} \] where \( x \) is the big integer.

This is consistent with Rust’s built-in behavior for left-shifting integers by an unsigned integer value.

§Examples

use arbi::Arbi;

assert_eq!(Arbi::zero() << 1_usize, 0);
assert_eq!(0 << 1, 0);

let mut a = Arbi::from(-1);

a <<= 0_usize;
assert_eq!(a, -1);
assert_eq!(a, -1 << 0);

a <<= 1_usize; // in-place
assert_eq!(a, -2);
assert_eq!(a, -1 << 1);

a = a << 1_usize; // in-place
assert_eq!(a, -4);
assert_eq!(a, -1 << 2);

a = &a << 1_usize; // clones (currently)
assert_eq!(a, -8);
assert_eq!(a, -1 << 3);
§Complexity

\( O(n) \)

Source§

type Output = Arbi

The resulting type after applying the << operator.
Source§

fn shl(self, rhs: u32) -> Arbi

Performs the << operation. Read more
Source§

impl Shl<u32> for Arbi

Source§

type Output = Arbi

The resulting type after applying the << operator.
Source§

fn shl(self, rhs: u32) -> Arbi

Performs the << operation. Read more
Source§

impl Shl<usize> for &Arbi

Return an Arbi integer representing this integer left-shifted shift bit positions with vacated bits zero-filled.

Mathematically, the value of the resulting integer is \[ x \times 2^{\text{shift}} \] where \( x \) is the big integer.

This is consistent with Rust’s built-in behavior for left-shifting integers by an unsigned integer value.

§Examples

use arbi::Arbi;

assert_eq!(Arbi::zero() << 1_usize, 0);
assert_eq!(0 << 1, 0);

let mut a = Arbi::from(-1);

a <<= 0_usize;
assert_eq!(a, -1);
assert_eq!(a, -1 << 0);

a <<= 1_usize; // in-place
assert_eq!(a, -2);
assert_eq!(a, -1 << 1);

a = a << 1_usize; // in-place
assert_eq!(a, -4);
assert_eq!(a, -1 << 2);

a = &a << 1_usize; // clones (currently)
assert_eq!(a, -8);
assert_eq!(a, -1 << 3);
§Complexity

\( O(n) \)

Source§

type Output = Arbi

The resulting type after applying the << operator.
Source§

fn shl(self, rhs: usize) -> Arbi

Performs the << operation. Read more
Source§

impl Shl<usize> for Arbi

Source§

type Output = Arbi

The resulting type after applying the << operator.
Source§

fn shl(self, rhs: usize) -> Arbi

Performs the << operation. Read more
Source§

impl<'a> ShlAssign<&'a u32> for Arbi

Source§

fn shl_assign(&mut self, rhs: &'a u32)

Performs the <<= operation. Read more
Source§

impl<'a> ShlAssign<&'a usize> for Arbi

Source§

fn shl_assign(&mut self, rhs: &'a usize)

Performs the <<= operation. Read more
Source§

impl ShlAssign<u32> for Arbi

Source§

fn shl_assign(&mut self, rhs: u32)

Performs the <<= operation. Read more
Source§

impl ShlAssign<usize> for Arbi

Source§

fn shl_assign(&mut self, rhs: usize)

Performs the <<= operation. Read more
Source§

impl<'a> Shr<&'a usize> for &Arbi

Source§

type Output = Arbi

The resulting type after applying the >> operator.
Source§

fn shr(self, rhs: &'a usize) -> Self::Output

Performs the >> operation. Read more
Source§

impl Shr<usize> for &Arbi

Return a new integer representing this integer right-shifted rhs bit positions. This is an arithmetic right shift with sign extension.

Mathematically, the value of the resulting integer is \( \frac{x}{2^{\text{shift}}} \), rounded down: \[ \left\lfloor \frac{x}{2^{\text{shift}}} \right\rfloor \] where \( x \) is the big integer.

This is consistent with Rust’s built-in behavior for right shifting primitive integer type values.

§Note

Currently, when right-shifting a reference to an Arbi (&Arbi), the operation involves cloning the Arbi integer, which incurs memory allocation. To avoid these allocations, prefer using the in-place right-shift operator >>= on a mutable reference (&mut Arbi), or the move-based right-shift operator >> on an Arbi instance.

§Examples

use arbi::Arbi;

let mut a = Arbi::from(-987654321);
// In-place
a >>= 1;
assert_eq!(a, -493827161);

// Also in-place
a = a >> 1;
assert_eq!(a, -246913581);

// Clones the Arbi integer
a = &a >> 1;
assert_eq!(a, -123456791);
§Complexity

\( O(n) \)

Source§

type Output = Arbi

The resulting type after applying the >> operator.
Source§

fn shr(self, rhs: usize) -> Self::Output

Performs the >> operation. Read more
Source§

impl Shr<usize> for Arbi

Source§

type Output = Arbi

The resulting type after applying the >> operator.
Source§

fn shr(self, rhs: usize) -> Self::Output

Performs the >> operation. Read more
Source§

impl ShrAssign<&usize> for Arbi

Source§

fn shr_assign(&mut self, rhs: &usize)

Performs the >>= operation. Read more
Source§

impl ShrAssign<usize> for Arbi

Source§

fn shr_assign(&mut self, rhs: usize)

Performs the >>= operation. Read more
Source§

impl<'b> Sub<&'b Arbi> for &Arbi

§Complexity

\( O(n) \)

Source§

type Output = Arbi

The resulting type after applying the - operator.
Source§

fn sub(self, other: &'b Arbi) -> Arbi

Performs the - operation. Read more
Source§

impl<'a> Sub<&'a Arbi> for Arbi

§Complexity

\( O(n) \)

Source§

type Output = Arbi

The resulting type after applying the - operator.
Source§

fn sub(self, other: &'a Arbi) -> Self

Performs the - operation. Read more
Source§

impl Sub for Arbi

§Complexity

\( O(n) \)

Source§

type Output = Arbi

The resulting type after applying the - operator.
Source§

fn sub(self, other: Self) -> Self

Performs the - operation. Read more
Source§

impl<'a> SubAssign<&'a Arbi> for Arbi

§Complexity

\( O(n) \)

Source§

fn sub_assign(&mut self, other: &'a Arbi)

Performs the -= operation. Read more
Source§

impl SubAssign for Arbi

§Complexity

\( O(n) \)

Source§

fn sub_assign(&mut self, other: Self)

Performs the -= operation. Read more
Source§

impl Eq for Arbi

Auto Trait Implementations§

§

impl Freeze for Arbi

§

impl RefUnwindSafe for Arbi

§

impl Send for Arbi

§

impl Sync for Arbi

§

impl Unpin for Arbi

§

impl UnwindSafe for Arbi

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dst: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dst. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T> ToString for T
where T: Display + ?Sized,

Source§

default fn to_string(&self) -> String

Converts the given value to a String. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.