pub struct Amount(pub u64);Expand description
An on-chain value amount, in the smallest indivisible unit (mojos).
Serializes ALWAYS as a decimal string on the wire — every value, small or large — so the
JavaScript/TypeScript binding maps it to a single bigint via BigInt(str): one code path,
no typeof branch, and never a silent precision loss past Number.MAX_SAFE_INTEGER (SPEC §3).
The Rust representation stays u64 because a Chia mojo amount always fits in 64 bits.
Deserialization accepts the canonical decimal string and — for leniency towards hand-written or legacy JSON — a bare JSON number, but serialization ALWAYS emits a string.
Tuple Fields§
§0: u64Implementations§
Trait Implementations§
impl Copy for Amount
Source§impl<'de> Deserialize<'de> for Amount
impl<'de> Deserialize<'de> for Amount
Source§fn deserialize<D: Deserializer<'de>>(deserializer: D) -> Result<Self, D::Error>
fn deserialize<D: Deserializer<'de>>(deserializer: D) -> Result<Self, D::Error>
Accept the canonical decimal string, and — leniently — a bare JSON number.
impl Eq for Amount
Source§impl Ord for Amount
impl Ord for Amount
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
Source§impl PartialOrd for Amount
impl PartialOrd for Amount
impl StructuralPartialEq for Amount
Auto Trait Implementations§
impl Freeze for Amount
impl RefUnwindSafe for Amount
impl Send for Amount
impl Sync for Amount
impl Unpin for Amount
impl UnsafeUnpin for Amount
impl UnwindSafe for Amount
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