Enum mexprp::Answer
[−]
[src]
pub enum Answer<N: Num> { Single(N), Multiple(Vec<N>), }
An answer of an evaluatation. Can be either a single answer or multiple. This struct contains some
helper methods for performing operations on single or multiple answers. The op
method takes another
Num
, and a function with two Num
arguments, itself and the other (as references). It performs
that function on all combinations and returns an answer with all of the results in one. The unop
function is similar but it performs an operation on only itself, without another value (unary
operation).
Variants
Single(N)
A single answer
Multiple(Vec<N>)
Multiple answers. Will always be at least two (probably)
Methods
impl<N: Num> Answer<N>
[src]
pub fn op<F: Fn(&N, &N) -> Calculation<N>>(
&self,
other: &Self,
oper: F
) -> Calculation<N>
[src]
&self,
other: &Self,
oper: F
) -> Calculation<N>
Perform an operation on all the values of an answer with all the values of another answer
pub fn unop<F: Fn(&N) -> Calculation<N>>(&self, oper: F) -> Calculation<N>
[src]
Perform an operation on all the values of an answer
pub fn unwrap_single(self) -> N
[src]
Unwrap the single variant of an answer
pub fn to_vec(self) -> Vec<N>
[src]
Convert this answer into a vector
pub fn join(self, other: Self) -> Self
[src]
Adds all the answers of another answer to the asnwers of this answer, returning a new answer
Trait Implementations
impl<N: Num> From<Answer<N>> for Term<N>
[src]
impl<N: Debug + Num> Debug for Answer<N>
[src]
fn fmt(&self, __arg_0: &mut Formatter) -> Result
[src]
Formats the value using the given formatter. Read more
impl<N: Clone + Num> Clone for Answer<N>
[src]
fn clone(&self) -> Answer<N>
[src]
Returns a copy of the value. Read more
fn clone_from(&mut self, source: &Self)
1.0.0[src]
Performs copy-assignment from source
. Read more
impl<N: PartialEq + Num> PartialEq for Answer<N>
[src]
fn eq(&self, __arg_0: &Answer<N>) -> bool
[src]
This method tests for self
and other
values to be equal, and is used by ==
. Read more
fn ne(&self, __arg_0: &Answer<N>) -> bool
[src]
This method tests for !=
.