pub struct Nat(/* private fields */);Expand description
A natural number of any size: Lean’s Nat.
Converts from every unsigned integer type, and back with TryFrom when the value fits.
It prints and parses as decimal digits.
use inlean_runtime::Nat;
let n: Nat = "340282366920938463463374607431768211456".parse().unwrap(); // 2^128
assert!(u128::try_from(&n).is_err());
assert_eq!(Nat::from(7u8).to_string(), "7");A Nat is Send and Sync, like an integer: it holds a number of its own. A clone of
a number too large for a machine word copies its digits.
Implementations§
Trait Implementations§
impl Eq for Nat
Source§impl Ord for Nat
impl Ord for Nat
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 Nat
impl PartialOrd for Nat
impl Send for Nat
impl Sync for Nat
Auto Trait Implementations§
impl !RefUnwindSafe for Nat
impl !UnwindSafe for Nat
impl Forget for Nat
impl Freeze for Nat
impl Move for Nat
impl Unpin for Nat
impl UnsafeUnpin for Nat
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