Struct exmex::ValOpsFactory

source ·
pub struct ValOpsFactory<I = i32, F = f64>
where I: DataType + PrimInt + Signed, F: DataType + Float,
{ /* private fields */ }
Expand description

feature = "value" - Factory of default operators for the data type Val.

Operators available in addition to those from FloatOpsFactory are:

representationdescription
%reminder of integers
|bitwise or of integers
&bitwise and of integers
XORbitwise exclusive or of integers
<<left shift of integers
>>right shift of integers
||or for booleans
&&and for booleans
ifreturns first operand if second is true, else Val::None, to make x if condition else y possible
elsereturns second operand if first is Val::None, else first, to make x if condition else y possible
==, !=, <, >, <=, >=comparison operators between numbers, e.g., 1 == 1.0 is true. Comparing booleans to none-booleans is false, e.g., 1 == true is false. Comparisons with Val::None or Val::Error always results in false, e.g., (5 if false) == (5 if false) is false.
factfactorial of integers
to_floatconvert integer, float, or bool to float
to_intconvert integer, float, or bool to integer

Trait Implementations§

source§

impl<I, F> Clone for ValOpsFactory<I, F>
where I: DataType + PrimInt + Signed + Clone, F: DataType + Float + Clone,

source§

fn clone(&self) -> ValOpsFactory<I, F>

Returns a copy of the value. Read more
1.0.0 · source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
source§

impl<I, F> Debug for ValOpsFactory<I, F>
where I: DataType + PrimInt + Signed + Debug, F: DataType + Float + Debug,

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
source§

impl<I, F> Default for ValOpsFactory<I, F>

source§

fn default() -> ValOpsFactory<I, F>

Returns the “default value” for a type. Read more
source§

impl<I, F> MakeOperators<Val<I, F>> for ValOpsFactory<I, F>
where I: DataType + PrimInt + Signed, F: DataType + Float, <I as FromStr>::Err: Debug, <F as FromStr>::Err: Debug,

source§

fn make<'a>() -> Vec<Operator<'a, Val<I, F>>>

Returns the default operators.

source§

impl<I, F> Ord for ValOpsFactory<I, F>
where I: DataType + PrimInt + Signed + Ord, F: DataType + Float + Ord,

source§

fn cmp(&self, other: &ValOpsFactory<I, F>) -> Ordering

This method returns an Ordering between self and other. Read more
1.21.0 · source§

fn max(self, other: Self) -> Self
where Self: Sized,

Compares and returns the maximum of two values. Read more
1.21.0 · source§

fn min(self, other: Self) -> Self
where Self: Sized,

Compares and returns the minimum of two values. Read more
1.50.0 · source§

fn clamp(self, min: Self, max: Self) -> Self
where Self: Sized + PartialOrd,

Restrict a value to a certain interval. Read more
source§

impl<I, F> PartialEq for ValOpsFactory<I, F>

source§

fn eq(&self, other: &ValOpsFactory<I, F>) -> bool

This method tests for self and other values to be equal, and is used by ==.
1.0.0 · source§

fn ne(&self, other: &Rhs) -> bool

This method tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
source§

impl<I, F> PartialOrd for ValOpsFactory<I, F>

source§

fn partial_cmp(&self, other: &ValOpsFactory<I, F>) -> Option<Ordering>

This method returns an ordering between self and other values if one exists. Read more
1.0.0 · source§

fn lt(&self, other: &Rhs) -> bool

This method tests less than (for self and other) and is used by the < operator. Read more
1.0.0 · source§

fn le(&self, other: &Rhs) -> bool

This method tests less than or equal to (for self and other) and is used by the <= operator. Read more
1.0.0 · source§

fn gt(&self, other: &Rhs) -> bool

This method tests greater than (for self and other) and is used by the > operator. Read more
1.0.0 · source§

fn ge(&self, other: &Rhs) -> bool

This method tests greater than or equal to (for self and other) and is used by the >= operator. Read more
source§

impl<I, F> Eq for ValOpsFactory<I, F>
where I: DataType + PrimInt + Signed + Eq, F: DataType + Float + Eq,

source§

impl<I, F> StructuralPartialEq for ValOpsFactory<I, F>
where I: DataType + PrimInt + Signed, F: DataType + Float,

Auto Trait Implementations§

§

impl<I, F> Freeze for ValOpsFactory<I, F>

§

impl<I, F> RefUnwindSafe for ValOpsFactory<I, F>

§

impl<I, F> Send for ValOpsFactory<I, F>
where I: Send, F: Send,

§

impl<I, F> Sync for ValOpsFactory<I, F>
where I: Sync, F: Sync,

§

impl<I, F> Unpin for ValOpsFactory<I, F>
where I: Unpin, F: Unpin,

§

impl<I, F> UnwindSafe for ValOpsFactory<I, F>
where I: UnwindSafe, F: UnwindSafe,

Blanket Implementations§

source§

impl<T> Any for T
where T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for T
where T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T, U> Into<U> for T
where U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

source§

impl<T> ToOwned for T
where T: Clone,

§

type Owned = T

The resulting type after obtaining ownership.
source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.