Trait Expr

Source
pub trait Expr:
    Arg
    + Sync
    + Send {
Show 41 methods // Required methods fn for_each_arg(&self, f: &mut dyn FnMut(&dyn Arg)); fn clone_box(&self) -> Box<dyn Expr>; fn str(&self) -> String; fn get_ref<'a>(&'a self) -> &'a dyn Expr; // Provided methods fn as_expr(&self) -> Option<Box<dyn Expr>> { ... } fn args(&self) -> Vec<Box<dyn Arg>> { ... } fn args_map_exprs( &self, _f: &dyn Fn(&dyn Expr) -> Box<dyn Arg>, ) -> Vec<Box<dyn Arg>> { ... } fn from_args(&self, args: Vec<Box<dyn Arg>>) -> Box<dyn Expr> { ... } fn as_arg(&self) -> Box<dyn Arg> { ... } fn as_function(&self) -> Option<&Func> { ... } fn equals(&self, other: &dyn Expr) -> bool { ... } fn as_symbol(&self) -> Option<Symbol> { ... } fn as_eq(&self) -> Option<Equation> { ... } fn as_mul(&self) -> Option<&Mul> { ... } fn as_pow(&self) -> Option<&Pow> { ... } fn as_f64(&self) -> Option<f64> { ... } fn to_cpp(&self) -> String { ... } fn simplify(&self) -> Box<dyn Expr> { ... } fn simplify_with_dimension(&self, dim: usize) -> Box<dyn Expr> { ... } fn as_int(&self) -> Option<Integer> { ... } fn pow(&self, exponent: &Box<dyn Expr>) -> Box<dyn Expr> { ... } fn ipow(&self, exponent: isize) -> Box<dyn Expr> { ... } fn sqrt(&self) -> Box<dyn Expr> { ... } fn get_exponent(&self) -> (Box<dyn Expr>, Box<dyn Expr>) { ... } fn diff(&self, var: &str, order: usize) -> Box<dyn Expr> { ... } fn name(&self) -> String { ... } fn subs(&self, substitutions: &[[Box<dyn Expr>; 2]]) -> Box<dyn Expr> { ... } fn has(&self, expr: &dyn Expr) -> bool { ... } fn has_box(&self, expr: Box<dyn Expr>) -> bool { ... } fn expand(&self) -> Box<dyn Expr> { ... } fn factor(&self, factors: &[&dyn Expr]) -> Box<dyn Expr> { ... } fn is_one(&self) -> bool { ... } fn is_neg_one(&self) -> bool { ... } fn is_number(&self) -> bool { ... } fn is_negative_number(&self) -> bool { ... } fn is_zero(&self) -> bool { ... } fn known_expr(&self) -> KnownExpr<'_> { ... } fn terms<'a>(&'a self) -> Box<dyn Iterator<Item = &'a dyn Expr> + 'a> { ... } fn get_coeff(&self) -> (Rational, Box<dyn Expr>) { ... } fn compare(&self, other: &dyn Expr) -> Option<Ordering> { ... } fn evaluate(&self, vars: Option<HashMap<Symbol, BoxExpr>>) -> BoxExpr { ... }
}

Required Methods§

Source

fn for_each_arg(&self, f: &mut dyn FnMut(&dyn Arg))

Source

fn clone_box(&self) -> Box<dyn Expr>

Source

fn str(&self) -> String

Source

fn get_ref<'a>(&'a self) -> &'a dyn Expr

Provided Methods§

Source

fn as_expr(&self) -> Option<Box<dyn Expr>>

Source

fn args(&self) -> Vec<Box<dyn Arg>>

Source

fn args_map_exprs( &self, _f: &dyn Fn(&dyn Expr) -> Box<dyn Arg>, ) -> Vec<Box<dyn Arg>>

Source

fn from_args(&self, args: Vec<Box<dyn Arg>>) -> Box<dyn Expr>

Source

fn as_arg(&self) -> Box<dyn Arg>

Source

fn as_function(&self) -> Option<&Func>

Source

fn equals(&self, other: &dyn Expr) -> bool

Source

fn as_symbol(&self) -> Option<Symbol>

Source

fn as_eq(&self) -> Option<Equation>

Source

fn as_mul(&self) -> Option<&Mul>

Source

fn as_pow(&self) -> Option<&Pow>

Source

fn as_f64(&self) -> Option<f64>

Source

fn to_cpp(&self) -> String

Source

fn simplify(&self) -> Box<dyn Expr>

Source

fn simplify_with_dimension(&self, dim: usize) -> Box<dyn Expr>

Source

fn as_int(&self) -> Option<Integer>

Source

fn pow(&self, exponent: &Box<dyn Expr>) -> Box<dyn Expr>

Source

fn ipow(&self, exponent: isize) -> Box<dyn Expr>

Source

fn sqrt(&self) -> Box<dyn Expr>

Source

fn get_exponent(&self) -> (Box<dyn Expr>, Box<dyn Expr>)

Source

fn diff(&self, var: &str, order: usize) -> Box<dyn Expr>

Source

fn name(&self) -> String

Source

fn subs(&self, substitutions: &[[Box<dyn Expr>; 2]]) -> Box<dyn Expr>

Source

fn has(&self, expr: &dyn Expr) -> bool

Source

fn has_box(&self, expr: Box<dyn Expr>) -> bool

Source

fn expand(&self) -> Box<dyn Expr>

Expands an expression. For example: (x + y) * z -> xz + yz

Source

fn factor(&self, factors: &[&dyn Expr]) -> Box<dyn Expr>

Factorizes an expression For example: factor(ax + cx + zy, [x]) -> (a + c)x + zy

Source

fn is_one(&self) -> bool

Source

fn is_neg_one(&self) -> bool

Source

fn is_number(&self) -> bool

Source

fn is_negative_number(&self) -> bool

Source

fn is_zero(&self) -> bool

Source

fn known_expr(&self) -> KnownExpr<'_>

Source

fn terms<'a>(&'a self) -> Box<dyn Iterator<Item = &'a dyn Expr> + 'a>

Source

fn get_coeff(&self) -> (Rational, Box<dyn Expr>)

Source

fn compare(&self, other: &dyn Expr) -> Option<Ordering>

Source

fn evaluate(&self, vars: Option<HashMap<Symbol, BoxExpr>>) -> BoxExpr

Trait Implementations§

Source§

impl Add<&(dyn Expr + 'static)> for Box<dyn Expr>

Source§

type Output = Box<dyn Expr>

The resulting type after applying the + operator.
Source§

fn add(self, rhs: &dyn Expr) -> Self::Output

Performs the + operation. Read more
Source§

impl Add<Box<dyn Expr>> for &dyn Expr

Source§

type Output = Box<dyn Expr>

The resulting type after applying the + operator.
Source§

fn add(self, rhs: Box<dyn Expr>) -> Self::Output

Performs the + operation. Read more
Source§

impl Add<isize> for Box<dyn Expr>

Source§

type Output = Box<dyn Expr>

The resulting type after applying the + operator.
Source§

fn add(self, rhs: isize) -> Self::Output

Performs the + operation. Read more
Source§

impl Add for &Box<dyn Expr>

Source§

type Output = Box<dyn Expr>

The resulting type after applying the + operator.
Source§

fn add(self, rhs: &Box<dyn Expr>) -> Self::Output

Performs the + operation. Read more
Source§

impl Add for &dyn Expr

Source§

type Output = Box<dyn Expr>

The resulting type after applying the + operator.
Source§

fn add(self, rhs: Self) -> Self::Output

Performs the + operation. Read more
Source§

impl Add for Box<dyn Expr>

Source§

type Output = Box<dyn Expr>

The resulting type after applying the + operator.
Source§

fn add(self, rhs: Box<dyn Expr>) -> Self::Output

Performs the + operation. Read more
Source§

impl AddAssign for Box<dyn Expr>

Source§

fn add_assign(&mut self, rhs: Self)

Performs the += operation. Read more
Source§

impl Arg for Box<dyn Expr>

Source§

fn srepr(&self) -> String

Source§

fn clone_arg(&self) -> Box<dyn Arg>

Source§

fn as_expr(&self) -> Option<Box<dyn Expr>>

Source§

fn map_expr(&self, f: &dyn Fn(&dyn Expr) -> Box<dyn Expr>) -> Box<dyn Arg>

Source§

impl AsAny for Box<dyn Expr>

Source§

fn as_any(&self) -> &dyn Any

Source§

impl Clone for Box<dyn Expr>

Source§

fn clone(&self) -> Self

Returns a duplicate 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 Debug for &dyn Expr

Source§

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

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

impl Debug for Box<dyn Expr>

Source§

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

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

impl Display for &dyn Expr

Source§

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

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

impl Display for Box<dyn Expr>

Source§

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

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

impl Div<&Box<dyn Expr>> for &dyn Expr

Source§

type Output = Box<dyn Expr>

The resulting type after applying the / operator.
Source§

fn div(self, rhs: &Box<dyn Expr>) -> Self::Output

Performs the / operation. Read more
Source§

impl Div<&Box<dyn Expr>> for Box<dyn Expr>

Source§

type Output = Box<dyn Expr>

The resulting type after applying the / operator.
Source§

fn div(self, rhs: &Box<dyn Expr>) -> Self::Output

Performs the / operation. Read more
Source§

impl<E: Expr> Div<&E> for Box<dyn Expr>

Source§

type Output = Box<dyn Expr>

The resulting type after applying the / operator.
Source§

fn div(self, rhs: &E) -> Self::Output

Performs the / operation. Read more
Source§

impl Div<&(dyn Expr + 'static)> for Box<dyn Expr>

Source§

type Output = Box<dyn Expr>

The resulting type after applying the / operator.
Source§

fn div(self, rhs: &dyn Expr) -> Self::Output

Performs the / operation. Read more
Source§

impl Div for &dyn Expr

Source§

type Output = Box<dyn Expr>

The resulting type after applying the / operator.
Source§

fn div(self, rhs: Self) -> Self::Output

Performs the / operation. Read more
Source§

impl Div for Box<dyn Expr>

Source§

type Output = Box<dyn Expr>

The resulting type after applying the / operator.
Source§

fn div(self, rhs: Box<dyn Expr>) -> Self::Output

Performs the / operation. Read more
Source§

impl DivAssign<&(dyn Expr + 'static)> for Box<dyn Expr>

Source§

fn div_assign(&mut self, rhs: &dyn Expr)

Performs the /= operation. Read more
Source§

impl DivAssign<&(dyn Expr + 'static)> for Equation

Source§

fn div_assign(&mut self, rhs: &dyn Expr)

Performs the /= operation. Read more
Source§

impl<'a> From<&'a Add> for &'a dyn Expr

Source§

fn from(value: &'a Add) -> Self

Converts to this type from the input type.
Source§

impl From<Box<dyn Arg>> for Box<dyn Expr>

Source§

fn from(value: Box<dyn Arg>) -> Self

Converts to this type from the input type.
Source§

impl FromStr for Box<dyn Expr>

Source§

type Err = ParseExprError

The associated error which can be returned from parsing.
Source§

fn from_str(s: &str) -> Result<Self, Self::Err>

Parses a string s to return a value of this type. Read more
Source§

impl Hash for dyn Expr

Source§

fn hash<H: Hasher>(&self, state: &mut H)

Feeds this value into the given Hasher. Read more
Source§

impl JsonSchema for dyn Expr

Source§

fn schema_name() -> Cow<'static, str>

The name of the generated JSON Schema. Read more
Source§

fn schema_id() -> Cow<'static, str>

Returns a string that uniquely identifies the schema produced by this type. Read more
Source§

fn json_schema(_generator: &mut SchemaGenerator) -> Schema

Generates a JSON Schema for this type. Read more
Source§

fn inline_schema() -> bool

Whether JSON Schemas generated for this type should be included directly in parent schemas, rather than being re-used where possible using the $ref keyword. Read more
Source§

impl Mul<&Box<dyn Expr>> for Box<dyn Expr>

Source§

type Output = Box<dyn Expr>

The resulting type after applying the * operator.
Source§

fn mul(self, rhs: &Box<dyn Expr>) -> Self::Output

Performs the * operation. Read more
Source§

impl<E: Expr> Mul<&E> for Box<dyn Expr>

Source§

type Output = Box<dyn Expr>

The resulting type after applying the * operator.
Source§

fn mul(self, rhs: &E) -> Self::Output

Performs the * operation. Read more
Source§

impl Mul<&(dyn Expr + 'static)> for &Box<dyn Expr>

Source§

type Output = Box<dyn Expr>

The resulting type after applying the * operator.
Source§

fn mul(self, rhs: &dyn Expr) -> Self::Output

Performs the * operation. Read more
Source§

impl Mul<&(dyn Expr + 'static)> for Add

Source§

type Output = Mul

The resulting type after applying the * operator.
Source§

fn mul(self, rhs: &dyn Expr) -> Self::Output

Performs the * operation. Read more
Source§

impl Mul<&(dyn Expr + 'static)> for Box<dyn Expr>

Source§

type Output = Box<dyn Expr>

The resulting type after applying the * operator.
Source§

fn mul(self, rhs: &dyn Expr) -> Self::Output

Performs the * operation. Read more
Source§

impl Mul<Box<dyn Expr>> for &dyn Expr

Source§

type Output = Box<dyn Expr>

The resulting type after applying the * operator.
Source§

fn mul(self, rhs: Box<dyn Expr>) -> Self::Output

Performs the * operation. Read more
Source§

impl<N: NumCast> Mul<N> for &dyn Expr

Source§

type Output = Box<dyn Expr>

The resulting type after applying the * operator.
Source§

fn mul(self, rhs: N) -> Self::Output

Performs the * operation. Read more
Source§

impl Mul<isize> for Box<dyn Expr>

Source§

type Output = Box<dyn Expr>

The resulting type after applying the * operator.
Source§

fn mul(self, rhs: isize) -> Self::Output

Performs the * operation. Read more
Source§

impl Mul for &Box<dyn Expr>

Source§

type Output = Box<dyn Expr>

The resulting type after applying the * operator.
Source§

fn mul(self, rhs: &Box<dyn Expr>) -> Self::Output

Performs the * operation. Read more
Source§

impl Mul for &dyn Expr

Source§

type Output = Box<dyn Expr>

The resulting type after applying the * operator.
Source§

fn mul(self, rhs: Self) -> Self::Output

Performs the * operation. Read more
Source§

impl Mul for Box<dyn Expr>

Source§

type Output = Box<dyn Expr>

The resulting type after applying the * operator.
Source§

fn mul(self, rhs: Box<dyn Expr>) -> Self::Output

Performs the * operation. Read more
Source§

impl MulAssign<&Box<dyn Expr>> for Box<dyn Expr>

Source§

fn mul_assign(&mut self, rhs: &Box<dyn Expr>)

Performs the *= operation. Read more
Source§

impl MulAssign<&(dyn Expr + 'static)> for Box<dyn Expr>

Source§

fn mul_assign(&mut self, rhs: &dyn Expr)

Performs the *= operation. Read more
Source§

impl MulAssign for Box<dyn Expr>

Source§

fn mul_assign(&mut self, rhs: Box<dyn Expr>)

Performs the *= operation. Read more
Source§

impl Neg for &Box<dyn Expr>

Source§

type Output = Box<dyn Expr>

The resulting type after applying the - operator.
Source§

fn neg(self) -> Self::Output

Performs the unary - operation. Read more
Source§

impl Neg for &dyn Expr

Source§

type Output = Box<dyn Expr>

The resulting type after applying the - operator.
Source§

fn neg(self) -> Self::Output

Performs the unary - operation. Read more
Source§

impl Neg for Box<dyn Expr>

Source§

type Output = Box<dyn Expr>

The resulting type after applying the - operator.
Source§

fn neg(self) -> Self::Output

Performs the unary - operation. Read more
Source§

impl PartialEq<&Box<dyn Expr>> for &dyn Expr

Source§

fn eq(&self, other: &&Box<dyn Expr>) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

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

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl PartialEq<&(dyn Expr + 'static)> for Box<dyn Expr>

Source§

fn eq(&self, other: &&dyn Expr) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

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

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl PartialEq<Box<dyn Expr>> for &dyn Expr

Source§

fn eq(&self, other: &Box<dyn Expr>) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

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

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl PartialEq for &dyn Expr

Source§

fn eq(&self, other: &Self) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

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

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl PartialEq for Box<dyn Expr>

Source§

fn eq(&self, other: &Self) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

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

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl Sub<&Box<dyn Expr>> for Box<dyn Expr>

Source§

type Output = Box<dyn Expr>

The resulting type after applying the - operator.
Source§

fn sub(self, rhs: &Box<dyn Expr>) -> Self::Output

Performs the - operation. Read more
Source§

impl Sub<Box<dyn Expr>> for &Box<dyn Expr>

Source§

type Output = Box<dyn Expr>

The resulting type after applying the - operator.
Source§

fn sub(self, rhs: Box<dyn Expr>) -> Self::Output

Performs the - operation. Read more
Source§

impl Sub for &Box<dyn Expr>

Source§

type Output = Box<dyn Expr>

The resulting type after applying the - operator.
Source§

fn sub(self, rhs: &Box<dyn Expr>) -> Self::Output

Performs the - operation. Read more
Source§

impl Sub for &dyn Expr

Source§

type Output = Box<dyn Expr>

The resulting type after applying the - operator.
Source§

fn sub(self, rhs: Self) -> Self::Output

Performs the - operation. Read more
Source§

impl Sub for Box<dyn Expr>

Source§

type Output = Box<dyn Expr>

The resulting type after applying the - operator.
Source§

fn sub(self, rhs: Box<dyn Expr>) -> Self::Output

Performs the - operation. Read more
Source§

impl SubAssign<&(dyn Expr + 'static)> for Box<dyn Expr>

Source§

fn sub_assign(&mut self, rhs: &dyn Expr)

Performs the -= operation. Read more
Source§

impl SubAssign<&(dyn Expr + 'static)> for Equation

Source§

fn sub_assign(&mut self, rhs: &dyn Expr)

Performs the -= operation. Read more
Source§

impl Eq for &dyn Expr

Source§

impl Eq for Box<dyn Expr>

Source§

impl ExprOperations for &dyn Expr

Implementors§