pub struct LogosDecimal(pub Decimal);Expand description
An exact base-10 fixed-point number — money’s runtime type on the compiled-to-Rust
path, the AOT mirror of the interpreter’s Decimal. decimal("19.99") compiles to
LogosDecimal::parse("19.99"); + − × stay exact Decimal (scale preserved), and ÷
widens to the exact LogosRational (base-10 division need not terminate). Display
shows the scale faithfully (19.99, 20.00), matching the interpreter.
Tuple Fields§
§0: DecimalImplementations§
Source§impl LogosDecimal
impl LogosDecimal
Sourcepub fn parse(s: &str) -> Self
pub fn parse(s: &str) -> Self
Parse the exact value from its literal text ("19.99"). Panics on malformed input,
which the LOGOS front-end has already rejected before codegen.
pub fn add(&self, other: &LogosDecimal) -> LogosDecimal
pub fn sub(&self, other: &LogosDecimal) -> LogosDecimal
pub fn mul(&self, other: &LogosDecimal) -> LogosDecimal
Sourcepub fn to_rational(&self) -> LogosRational
pub fn to_rational(&self) -> LogosRational
The exact rational view (coeff / 10^scale) — the bridge ÷ widens through.
Sourcepub fn div_exact(&self, other: &LogosDecimal) -> LogosRational
pub fn div_exact(&self, other: &LogosDecimal) -> LogosRational
Exact division, widening to a LogosRational (base-10 division need not terminate).
Panics on a zero divisor, mirroring integer / 0.
Sourcepub fn abs(&self) -> LogosDecimal
pub fn abs(&self) -> LogosDecimal
The exact absolute value (scale preserved).
Trait Implementations§
Source§impl Clone for LogosDecimal
impl Clone for LogosDecimal
Source§fn clone(&self) -> LogosDecimal
fn clone(&self) -> LogosDecimal
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for LogosDecimal
impl Debug for LogosDecimal
Source§impl Display for LogosDecimal
impl Display for LogosDecimal
Source§impl From<i64> for LogosDecimal
impl From<i64> for LogosDecimal
Source§impl Hash for LogosDecimal
impl Hash for LogosDecimal
Source§impl Ord for LogosDecimal
impl Ord for LogosDecimal
Source§fn cmp(&self, other: &LogosDecimal) -> Ordering
fn cmp(&self, other: &LogosDecimal) -> Ordering
1.21.0 (const: unstable) · Source§fn max(self, other: Self) -> Selfwhere
Self: Sized,
fn max(self, other: Self) -> Selfwhere
Self: Sized,
Source§impl PartialEq for LogosDecimal
impl PartialEq for LogosDecimal
Source§fn eq(&self, other: &LogosDecimal) -> bool
fn eq(&self, other: &LogosDecimal) -> bool
self and other values to be equal, and is used by ==.Source§impl PartialOrd for LogosDecimal
impl PartialOrd for LogosDecimal
impl Eq for LogosDecimal
impl StructuralPartialEq for LogosDecimal
Auto Trait Implementations§
impl Freeze for LogosDecimal
impl RefUnwindSafe for LogosDecimal
impl Send for LogosDecimal
impl Sync for LogosDecimal
impl Unpin for LogosDecimal
impl UnsafeUnpin for LogosDecimal
impl UnwindSafe for LogosDecimal
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§impl<Q, K> Comparable<K> for Q
impl<Q, K> Comparable<K> for Q
§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.