pub trait TowerValue: Clone + Sized {
Show 21 methods
// Required methods
fn exact(&self) -> Option<ExactRef<'_, Self>>;
fn standard_rational(&self) -> Option<Rational>;
fn integer(&self) -> Option<BigInt>;
fn exact_rational(&self) -> Option<Rational>;
fn is_standard_number(&self) -> bool;
fn text(&self) -> Option<&str>;
fn type_name(&self) -> String;
fn display_string(&self) -> String;
fn values_equal(&self, other: &Self) -> bool;
fn is_nothing(&self) -> bool;
fn from_rational(r: Rational) -> Self;
fn from_bigint(b: BigInt) -> Self;
fn boolean(b: bool) -> Self;
fn nothing() -> Self;
fn algebraic(a: Algebraic) -> Self;
fn exact_real(x: ExactReal) -> Self;
fn hyper(h: HyperValue) -> Self;
fn natural(n: NaturalValue) -> Self;
fn ordinal(o: Ordinal) -> Self;
fn depends(d: DependsValue<Self>) -> Self;
fn converging(c: Converging<Self>) -> Self;
}Expand description
A value model that holds the exact types: how to see a value as one of them or as a standard number, and how to build one. The interpreter’s runtime value and a compiled program’s value each implement it; every operation in this module is generic over it.
Required Methods§
Sourcefn exact(&self) -> Option<ExactRef<'_, Self>>
fn exact(&self) -> Option<ExactRef<'_, Self>>
The value as one of the exact types, or None for any other value.
Sourcefn standard_rational(&self) -> Option<Rational>
fn standard_rational(&self) -> Option<Rational>
An integer, rational, decimal or finite float as the rational it denotes exactly.
Sourcefn exact_rational(&self) -> Option<Rational>
fn exact_rational(&self) -> Option<Rational>
An integer or a rational: a number held exactly, never a float or a decimal.
Sourcefn is_standard_number(&self) -> bool
fn is_standard_number(&self) -> bool
An integer, rational, decimal or float: its own standard part.
Sourcefn display_string(&self) -> String
fn display_string(&self) -> String
How the value prints.
Sourcefn values_equal(&self, other: &Self) -> bool
fn values_equal(&self, other: &Self) -> bool
The language’s equality on two values.
Sourcefn is_nothing(&self) -> bool
fn is_nothing(&self) -> bool
Whether the value is nothing.
Sourcefn from_rational(r: Rational) -> Self
fn from_rational(r: Rational) -> Self
A rational in its smallest form: an Int when it fits, a big integer, else a rational.
Sourcefn from_bigint(b: BigInt) -> Self
fn from_bigint(b: BigInt) -> Self
An integer in its smallest form.
fn boolean(b: bool) -> Self
fn nothing() -> Self
fn algebraic(a: Algebraic) -> Self
fn exact_real(x: ExactReal) -> Self
fn hyper(h: HyperValue) -> Self
fn natural(n: NaturalValue) -> Self
fn ordinal(o: Ordinal) -> Self
fn depends(d: DependsValue<Self>) -> Self
fn converging(c: Converging<Self>) -> Self
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.