pub enum Num {
Small(i64),
Big(Rc<BigInt>),
}Expand description
an integer value (§4.5): a machine word when it fits, arbitrary precision
otherwise. The reference and Python hold every integer as a big integer;
here the common small values avoid a heap allocation and a deep copy on
clone, which dominate at scale (F21). Always normalized — a Big never
holds a value that fits in i64 — so equality and ordering are the
machine-word comparison whenever both operands are small, and a Small
never equals a Big.
Variants§
Implementations§
Trait Implementations§
Source§impl AddAssign<i64> for Num
impl AddAssign<i64> for Num
Source§fn add_assign(&mut self, n: i64)
fn add_assign(&mut self, n: i64)
Performs the
+= operation. Read moreimpl Eq for Num
Source§impl Ord for Num
impl Ord for Num
1.21.0 (const: unstable) · Source§fn max(self, other: Self) -> Selfwhere
Self: Sized,
fn max(self, other: Self) -> Selfwhere
Self: Sized,
Compares and returns the maximum of two values. Read more
1.21.0 (const: unstable) · Source§fn min(self, other: Self) -> Selfwhere
Self: Sized,
fn min(self, other: Self) -> Selfwhere
Self: Sized,
Compares and returns the minimum of two values. Read more
Source§impl PartialOrd for Num
impl PartialOrd for Num
Auto Trait Implementations§
impl !Send for Num
impl !Sync for Num
impl Forget for Num
impl Freeze for Num
impl Move for Num
impl RefUnwindSafe for Num
impl Unpin for Num
impl UnsafeUnpin for Num
impl UnwindSafe for Num
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<Q, K> Comparable<K> for Q
impl<Q, K> Comparable<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Compare self to
key and return true if they are equal.