Struct mexprp::Expression
[−]
[src]
pub struct Expression<N: Num> { pub string: String, pub ctx: Context<N>, pub term: Term<N>, }
The main Expression struct. Contains the string that was originally requested to be parsed, the context the Expression was parsed with, and the Term the raw form was parsed as. For just the parsed version of the expression, use the Term enum.
Fields
string: String
The original string passed into this expression
ctx: Context<N>
Context the expression was parsed with
term: Term<N>
The term this string has been parsed as
Methods
impl<N: Num + 'static> Expression<N>
[src]
pub fn parse(raw: &str) -> Result<Self, ParseError>
[src]
Parse a string into an expression
pub fn parse_ctx(raw: &str, ctx: Context<N>) -> Result<Self, ParseError>
[src]
Parse a string into an expression with the given context
pub fn eval(&self) -> Calculation<N>
[src]
Evaluate the expression
pub fn eval_ctx(&self, ctx: &Context<N>) -> Calculation<N>
[src]
Evaluate the expression with the given context
Trait Implementations
impl<N: Debug + Num> Debug for Expression<N>
[src]
fn fmt(&self, __arg_0: &mut Formatter) -> Result
[src]
Formats the value using the given formatter. Read more
impl<N: Num> Display for Expression<N>
[src]
fn fmt(&self, f: &mut Formatter) -> Result
[src]
Formats the value using the given formatter. Read more
impl<N: Num> From<Expression<N>> for Term<N>
[src]
fn from(t: Expression<N>) -> Term<N>
[src]
Performs the conversion.