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 cannot be sent to another thread: Lean counts references without synchronization.
Trait Implementations§
impl Eq for Nat
impl FromLean 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 ToLean for Nat
Auto Trait Implementations§
impl !RefUnwindSafe for Nat
impl !Send for Nat
impl !Sync 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