Enum calc::Value
[−]
[src]
pub enum Value { Dec(i64), Hex(i64), Float(f64), }
Represents a canonical value that can be calculated by this library
Variants
Dec(i64)
An integral value in decimal form. This is generally interoperable
with
the Hex
constructor, but will be overriden by the Hex
constructor.
Hex(i64)
An integral value in hexadecimal form. This takes precedence over
the
Dec
constructor.
Float(f64)
A floating point number
Methods
impl Value
[src]
fn is_zero(&self) -> bool
fn as_float(&self) -> f64
fn intmap<F, T>(self, that: Value, op: T, f: F) -> Result<Value, CalcError> where
F: Fn(i64, i64) -> i64,
T: ToString,
F: Fn(i64, i64) -> i64,
T: ToString,
Represents a computation that can only operate on, and return, integer values
fn castmap<F, G>(self, that: Value, f: F, g: G) -> Value where
F: Fn(i64, i64) -> i64,
G: Fn(f64, f64) -> f64,
F: Fn(i64, i64) -> i64,
G: Fn(f64, f64) -> f64,
Represents a computation that will cast integer types to floating point
fn pow(self, that: Value) -> Result<Self, CalcError>
fn powu(self, i: u32) -> Self
Trait Implementations
impl Clone for Value
[src]
fn clone(&self) -> Value
Returns a copy of the value. Read more
fn clone_from(&mut self, source: &Self)
1.0.0
Performs copy-assignment from source
. Read more
impl Debug for Value
[src]
impl PartialEq for Value
[src]
fn eq(&self, __arg_0: &Value) -> bool
This method tests for self
and other
values to be equal, and is used by ==
. Read more
fn ne(&self, __arg_0: &Value) -> bool
This method tests for !=
.
impl Display for Value
[src]
impl Add for Value
[src]
type Output = Self
The resulting type after applying the +
operator
fn add(self, that: Value) -> Self::Output
The method for the +
operator
impl Sub for Value
[src]
type Output = Self
The resulting type after applying the -
operator
fn sub(self, that: Value) -> Self::Output
The method for the -
operator
impl Mul for Value
[src]
type Output = Self
The resulting type after applying the *
operator
fn mul(self, that: Value) -> Self::Output
The method for the *
operator
impl Div for Value
[src]
type Output = Result<Self, CalcError>
The resulting type after applying the /
operator
fn div(self, that: Value) -> Self::Output
The method for the /
operator
impl BitAnd for Value
[src]
type Output = Result<Self, CalcError>
The resulting type after applying the &
operator
fn bitand(self, that: Value) -> Self::Output
The method for the &
operator
impl BitOr for Value
[src]
type Output = Result<Self, CalcError>
The resulting type after applying the |
operator
fn bitor(self, that: Value) -> Self::Output
The method for the |
operator
impl BitXor for Value
[src]
type Output = Result<Self, CalcError>
The resulting type after applying the ^
operator
fn bitxor(self, that: Value) -> Self::Output
The method for the ^
operator
impl Neg for Value
[src]
type Output = Self
The resulting type after applying the -
operator
fn neg(self) -> Self::Output
The method for the unary -
operator
impl Not for Value
[src]
type Output = Result<Self, CalcError>
The resulting type after applying the !
operator
fn not(self) -> Self::Output
The method for the unary !
operator
impl Rem for Value
[src]
type Output = Result<Self, CalcError>
The resulting type after applying the %
operator
fn rem(self, that: Value) -> Self::Output
The method for the %
operator
impl Shl<Value> for Value
[src]
type Output = Result<Self, CalcError>
The resulting type after applying the <<
operator
fn shl(self, that: Value) -> Self::Output
The method for the <<
operator