Expr

Enum Expr 

Source
pub enum Expr {
Show 147 variants Constant(f64), BigInt(BigInt), Rational(BigRational), Boolean(bool), Variable(String), Pattern(String), Add(Arc<Expr>, Arc<Expr>), Sub(Arc<Expr>, Arc<Expr>), Mul(Arc<Expr>, Arc<Expr>), Div(Arc<Expr>, Arc<Expr>), Power(Arc<Expr>, Arc<Expr>), Neg(Arc<Expr>), AddList(Vec<Expr>), MulList(Vec<Expr>), Sin(Arc<Expr>), Cos(Arc<Expr>), Tan(Arc<Expr>), Exp(Arc<Expr>), Log(Arc<Expr>), Abs(Arc<Expr>), Sqrt(Arc<Expr>), Eq(Arc<Expr>, Arc<Expr>), Lt(Arc<Expr>, Arc<Expr>), Gt(Arc<Expr>, Arc<Expr>), Le(Arc<Expr>, Arc<Expr>), Ge(Arc<Expr>, Arc<Expr>), Matrix(Vec<Vec<Expr>>), Vector(Vec<Expr>), Complex(Arc<Expr>, Arc<Expr>), Transpose(Arc<Expr>), MatrixMul(Arc<Expr>, Arc<Expr>), MatrixVecMul(Arc<Expr>, Arc<Expr>), Inverse(Arc<Expr>), Derivative(Arc<Expr>, String), DerivativeN(Arc<Expr>, String, Arc<Expr>), Integral { integrand: Arc<Expr>, var: Arc<Expr>, lower_bound: Arc<Expr>, upper_bound: Arc<Expr>, }, VolumeIntegral { scalar_field: Arc<Expr>, volume: Arc<Expr>, }, SurfaceIntegral { vector_field: Arc<Expr>, surface: Arc<Expr>, }, Limit(Arc<Expr>, String, Arc<Expr>), Sum { body: Arc<Expr>, var: Arc<Expr>, from: Arc<Expr>, to: Arc<Expr>, }, Series(Arc<Expr>, String, Arc<Expr>, Arc<Expr>), Summation(Arc<Expr>, String, Arc<Expr>, Arc<Expr>), Product(Arc<Expr>, String, Arc<Expr>, Arc<Expr>), ConvergenceAnalysis(Arc<Expr>, String), AsymptoticExpansion(Arc<Expr>, String, Arc<Expr>, Arc<Expr>), Sec(Arc<Expr>), Csc(Arc<Expr>), Cot(Arc<Expr>), ArcSin(Arc<Expr>), ArcCos(Arc<Expr>), ArcTan(Arc<Expr>), ArcSec(Arc<Expr>), ArcCsc(Arc<Expr>), ArcCot(Arc<Expr>), Sinh(Arc<Expr>), Cosh(Arc<Expr>), Tanh(Arc<Expr>), Sech(Arc<Expr>), Csch(Arc<Expr>), Coth(Arc<Expr>), ArcSinh(Arc<Expr>), ArcCosh(Arc<Expr>), ArcTanh(Arc<Expr>), ArcSech(Arc<Expr>), ArcCsch(Arc<Expr>), ArcCoth(Arc<Expr>), LogBase(Arc<Expr>, Arc<Expr>), Atan2(Arc<Expr>, Arc<Expr>), Binomial(Arc<Expr>, Arc<Expr>), Factorial(Arc<Expr>), Permutation(Arc<Expr>, Arc<Expr>), Combination(Arc<Expr>, Arc<Expr>), FallingFactorial(Arc<Expr>, Arc<Expr>), RisingFactorial(Arc<Expr>, Arc<Expr>), Path(PathType, Arc<Expr>, Arc<Expr>), Boundary(Arc<Expr>), Domain(String), Pi, E, Infinity, NegativeInfinity, Gamma(Arc<Expr>), Beta(Arc<Expr>, Arc<Expr>), Erf(Arc<Expr>), Erfc(Arc<Expr>), Erfi(Arc<Expr>), Zeta(Arc<Expr>), BesselJ(Arc<Expr>, Arc<Expr>), BesselY(Arc<Expr>, Arc<Expr>), LegendreP(Arc<Expr>, Arc<Expr>), LaguerreL(Arc<Expr>, Arc<Expr>), HermiteH(Arc<Expr>, Arc<Expr>), Digamma(Arc<Expr>), KroneckerDelta(Arc<Expr>, Arc<Expr>), And(Vec<Expr>), Or(Vec<Expr>), Not(Arc<Expr>), Xor(Arc<Expr>, Arc<Expr>), Implies(Arc<Expr>, Arc<Expr>), Equivalent(Arc<Expr>, Arc<Expr>), Predicate { name: String, args: Vec<Expr>, }, ForAll(String, Arc<Expr>), Exists(String, Arc<Expr>), Union(Vec<Expr>), Interval(Arc<Expr>, Arc<Expr>, bool, bool), Polynomial(Vec<Expr>), SparsePolynomial(SparsePolynomial), Floor(Arc<Expr>), IsPrime(Arc<Expr>), Gcd(Arc<Expr>, Arc<Expr>), Mod(Arc<Expr>, Arc<Expr>), Solve(Arc<Expr>, String), Substitute(Arc<Expr>, String, Arc<Expr>), System(Vec<Expr>), Solutions(Vec<Expr>), ParametricSolution { x: Arc<Expr>, y: Arc<Expr>, }, RootOf { poly: Arc<Expr>, index: u32, }, InfiniteSolutions, NoSolution, Ode { equation: Arc<Expr>, func: String, var: String, }, Pde { equation: Arc<Expr>, func: String, vars: Vec<String>, }, GeneralSolution(Arc<Expr>), ParticularSolution(Arc<Expr>), Fredholm(Arc<Expr>, Arc<Expr>, Arc<Expr>, Arc<Expr>), Volterra(Arc<Expr>, Arc<Expr>, Arc<Expr>, Arc<Expr>), Apply(Arc<Expr>, Arc<Expr>), Tuple(Vec<Expr>), Dag(Arc<DagNode>), Distribution(Arc<dyn Distribution>), Max(Arc<Expr>, Arc<Expr>), Quantity(Arc<UnitQuantity>), QuantityWithValue(Arc<Expr>, String), CustomZero, CustomString(String), CustomArcOne(Arc<Expr>), CustomArcTwo(Arc<Expr>, Arc<Expr>), CustomArcThree(Arc<Expr>, Arc<Expr>, Arc<Expr>), CustomArcFour(Arc<Expr>, Arc<Expr>, Arc<Expr>, Arc<Expr>), CustomArcFive(Arc<Expr>, Arc<Expr>, Arc<Expr>, Arc<Expr>, Arc<Expr>), CustomVecOne(Vec<Expr>), CustomVecTwo(Vec<Expr>, Vec<Expr>), CustomVecThree(Vec<Expr>, Vec<Expr>, Vec<Expr>), CustomVecFour(Vec<Expr>, Vec<Expr>, Vec<Expr>, Vec<Expr>), CustomVecFive(Vec<Expr>, Vec<Expr>, Vec<Expr>, Vec<Expr>, Vec<Expr>), UnaryList(String, Arc<Expr>), BinaryList(String, Arc<Expr>, Arc<Expr>), NaryList(String, Vec<Expr>),
}
Expand description

The central enum representing a mathematical expression in the symbolic system.

Expr is an Abstract Syntax Tree (AST) that can represent a wide variety of mathematical objects and operations. Manual implementations for Debug, Clone, PartialEq, Eq, and Hash are provided to handle variants containing types that do not derive these traits automatically (e.g., f64, Arc<dyn Distribution>).

Variants§

§

Constant(f64)

A floating-point constant (64-bit).

§

BigInt(BigInt)

An arbitrary-precision integer.

§

Rational(BigRational)

An arbitrary-precision rational number.

§

Boolean(bool)

A boolean value (true or false).

§

Variable(String)

A symbolic variable, represented by a string name.

§

Pattern(String)

A pattern variable, used for rule-matching systems.

§

Add(Arc<Expr>, Arc<Expr>)

Addition of two expressions.

§

Sub(Arc<Expr>, Arc<Expr>)

Subtraction of two expressions.

§

Mul(Arc<Expr>, Arc<Expr>)

Multiplication of two expressions.

§

Div(Arc<Expr>, Arc<Expr>)

Division of two expressions.

§

Power(Arc<Expr>, Arc<Expr>)

Exponentiation (base raised to the power of exponent).

§

Neg(Arc<Expr>)

Negation of an expression.

§

AddList(Vec<Expr>)

N-ary Addition (Sum of a list of expressions).

This variant represents the sum of multiple expressions in a single operation, which is more efficient than nested binary Add operations for associative operations. It’s part of the AST to DAG migration strategy, allowing for more flexible expression representation without breaking existing code.

§Examples

use rssn::symbolic::core::Expr;

// Representing a + b + c + d as a single n-ary operation
let sum = Expr::AddList(vec![
    Expr::Variable("a".to_string()),
    Expr::Variable("b".to_string()),
    Expr::Variable("c".to_string()),
    Expr::Variable("d".to_string()),
]);
§

MulList(Vec<Expr>)

N-ary Multiplication (Product of a list of expressions).

This variant represents the product of multiple expressions in a single operation, which is more efficient than nested binary Mul operations for associative operations. It’s part of the AST to DAG migration strategy, allowing for more flexible expression representation without breaking existing code.

§Examples

use rssn::symbolic::core::Expr;

// Representing a * b * c * d as a single n-ary operation
let product = Expr::MulList(vec![
    Expr::Variable("a".to_string()),
    Expr::Variable("b".to_string()),
    Expr::Variable("c".to_string()),
    Expr::Variable("d".to_string()),
]);
§

Sin(Arc<Expr>)

The sine function.

§

Cos(Arc<Expr>)

The cosine function.

§

Tan(Arc<Expr>)

The tangent function.

§

Exp(Arc<Expr>)

The natural exponential function, e^x.

§

Log(Arc<Expr>)

The natural logarithm, ln(x).

§

Abs(Arc<Expr>)

The absolute value function, |x|.

§

Sqrt(Arc<Expr>)

The square root function.

§

Eq(Arc<Expr>, Arc<Expr>)

Represents an equation (left = right).

§

Lt(Arc<Expr>, Arc<Expr>)

Less than (<).

§

Gt(Arc<Expr>, Arc<Expr>)

Greater than (>).

§

Le(Arc<Expr>, Arc<Expr>)

Less than or equal to (<=).

§

Ge(Arc<Expr>, Arc<Expr>)

Greater than or equal to (>=).

§

Matrix(Vec<Vec<Expr>>)

A matrix, represented as a vector of row vectors.

§

Vector(Vec<Expr>)

A vector (or column matrix).

§

Complex(Arc<Expr>, Arc<Expr>)

A complex number with real and imaginary parts.

§

Transpose(Arc<Expr>)

Matrix transpose.

§

MatrixMul(Arc<Expr>, Arc<Expr>)

Matrix-matrix multiplication.

§

MatrixVecMul(Arc<Expr>, Arc<Expr>)

Matrix-vector multiplication.

§

Inverse(Arc<Expr>)

Matrix inverse.

§

Derivative(Arc<Expr>, String)

The derivative of an expression with respect to a variable.

§

DerivativeN(Arc<Expr>, String, Arc<Expr>)

The N-th derivative of an expression.

§

Integral

A definite integral of integrand with respect to var from lower_bound to upper_bound.

Fields

§integrand: Arc<Expr>
§var: Arc<Expr>
§lower_bound: Arc<Expr>
§upper_bound: Arc<Expr>
§

VolumeIntegral

A volume integral of a scalar field over a specified volume.

Fields

§scalar_field: Arc<Expr>
§volume: Arc<Expr>
§

SurfaceIntegral

A surface integral of a vector field over a specified surface.

Fields

§vector_field: Arc<Expr>
§surface: Arc<Expr>
§

Limit(Arc<Expr>, String, Arc<Expr>)

A limit of an expression as a variable approaches a point.

§

Sum

A summation of body with var from from to to.

Fields

§body: Arc<Expr>
§var: Arc<Expr>
§from: Arc<Expr>
§to: Arc<Expr>
§

Series(Arc<Expr>, String, Arc<Expr>, Arc<Expr>)

A finite or infinite series expansion.

§

Summation(Arc<Expr>, String, Arc<Expr>, Arc<Expr>)

A summation over a range (similar to Sum).

§

Product(Arc<Expr>, String, Arc<Expr>, Arc<Expr>)

A product of terms over a range.

§

ConvergenceAnalysis(Arc<Expr>, String)

Represents a convergence analysis for a series.

§

AsymptoticExpansion(Arc<Expr>, String, Arc<Expr>, Arc<Expr>)

An asymptotic expansion of a function.

§

Sec(Arc<Expr>)

Secant function.

§

Csc(Arc<Expr>)

Cosecant function.

§

Cot(Arc<Expr>)

Cotangent function.

§

ArcSin(Arc<Expr>)

Arcsine (inverse sine).

§

ArcCos(Arc<Expr>)

Arccosine (inverse cosine).

§

ArcTan(Arc<Expr>)

Arctangent (inverse tangent).

§

ArcSec(Arc<Expr>)

Arcsecant (inverse secant).

§

ArcCsc(Arc<Expr>)

Arccosecant (inverse cosecant).

§

ArcCot(Arc<Expr>)

Arccotangent (inverse cotangent).

§

Sinh(Arc<Expr>)

Hyperbolic sine.

§

Cosh(Arc<Expr>)

Hyperbolic cosine.

§

Tanh(Arc<Expr>)

Hyperbolic tangent.

§

Sech(Arc<Expr>)

Hyperbolic secant.

§

Csch(Arc<Expr>)

Hyperbolic cosecant.

§

Coth(Arc<Expr>)

Hyperbolic cotangent.

§

ArcSinh(Arc<Expr>)

Inverse hyperbolic sine.

§

ArcCosh(Arc<Expr>)

Inverse hyperbolic cosine.

§

ArcTanh(Arc<Expr>)

Inverse hyperbolic tangent.

§

ArcSech(Arc<Expr>)

Inverse hyperbolic secant.

§

ArcCsch(Arc<Expr>)

Inverse hyperbolic cosecant.

§

ArcCoth(Arc<Expr>)

Inverse hyperbolic cotangent.

§

LogBase(Arc<Expr>, Arc<Expr>)

Logarithm with a specified base.

§

Atan2(Arc<Expr>, Arc<Expr>)

Two-argument arctangent.

§

Binomial(Arc<Expr>, Arc<Expr>)

Binomial coefficient, “n choose k”.

§

Factorial(Arc<Expr>)

Factorial, n!.

§

Permutation(Arc<Expr>, Arc<Expr>)

Permutations, P(n, k).

§

Combination(Arc<Expr>, Arc<Expr>)

Combinations, C(n, k).

§

FallingFactorial(Arc<Expr>, Arc<Expr>)

Falling factorial.

§

RisingFactorial(Arc<Expr>, Arc<Expr>)

Rising factorial.

§

Path(PathType, Arc<Expr>, Arc<Expr>)

A path for path integrals (e.g., line, circle).

§

Boundary(Arc<Expr>)

Represents the boundary of a domain.

§

Domain(String)

Represents a named domain (e.g., for integrals).

§

Pi

The mathematical constant Pi (π).

§

E

The mathematical constant E (e, Euler’s number).

§

Infinity

Represents infinity.

§

NegativeInfinity

Represents negative infinity.

§

Gamma(Arc<Expr>)

The Gamma function.

§

Beta(Arc<Expr>, Arc<Expr>)

The Beta function.

§

Erf(Arc<Expr>)

The error function.

§

Erfc(Arc<Expr>)

The complementary error function.

§

Erfi(Arc<Expr>)

The imaginary error function.

§

Zeta(Arc<Expr>)

The Riemann Zeta function.

§

BesselJ(Arc<Expr>, Arc<Expr>)

Bessel function of the first kind.

§

BesselY(Arc<Expr>, Arc<Expr>)

Bessel function of the second kind.

§

LegendreP(Arc<Expr>, Arc<Expr>)

Legendre polynomial.

§

LaguerreL(Arc<Expr>, Arc<Expr>)

Laguerre polynomial.

§

HermiteH(Arc<Expr>, Arc<Expr>)

Hermite polynomial.

§

Digamma(Arc<Expr>)

The digamma function (psi function).

§

KroneckerDelta(Arc<Expr>, Arc<Expr>)

The Kronecker delta function.

§

And(Vec<Expr>)

Logical AND of a vector of expressions.

§

Or(Vec<Expr>)

Logical OR of a vector of expressions.

§

Not(Arc<Expr>)

Logical NOT.

§

Xor(Arc<Expr>, Arc<Expr>)

Logical XOR (exclusive OR).

§

Implies(Arc<Expr>, Arc<Expr>)

Logical implication (A => B).

§

Equivalent(Arc<Expr>, Arc<Expr>)

Logical equivalence (A <=> B).

§

Predicate

A predicate with a name and arguments.

Fields

§name: String
§args: Vec<Expr>
§

ForAll(String, Arc<Expr>)

Universal quantifier (“for all”).

§

Exists(String, Arc<Expr>)

Existential quantifier (“there exists”).

§

Union(Vec<Expr>)

A union of sets or intervals.

§

Interval(Arc<Expr>, Arc<Expr>, bool, bool)

An interval with a lower and upper bound, and flags for inclusion.

§

Polynomial(Vec<Expr>)

A dense polynomial represented by its coefficients.

§

SparsePolynomial(SparsePolynomial)

A sparse polynomial.

§

Floor(Arc<Expr>)

The floor function.

§

IsPrime(Arc<Expr>)

A predicate to check if a number is prime.

§

Gcd(Arc<Expr>, Arc<Expr>)

Greatest Common Divisor (GCD).

§

Mod(Arc<Expr>, Arc<Expr>)

Modulo operation.

§

Solve(Arc<Expr>, String)

Represents the action of solving an equation for a variable.

§

Substitute(Arc<Expr>, String, Arc<Expr>)

Represents the substitution of a variable in an expression with another expression.

§

System(Vec<Expr>)

Represents a system of equations to be solved.

§

Solutions(Vec<Expr>)

Represents the set of solutions to an equation or system.

§

ParametricSolution

A parametric solution, e.g., for a system of ODEs.

Fields

§

RootOf

Represents the i-th root of a polynomial.

Fields

§poly: Arc<Expr>
§index: u32
§

InfiniteSolutions

Represents infinite solutions.

§

NoSolution

Represents that no solution exists.

§

Ode

An ordinary differential equation (ODE).

Fields

§equation: Arc<Expr>
§func: String
§

Pde

A partial differential equation (PDE).

Fields

§equation: Arc<Expr>
§func: String
§vars: Vec<String>
§

GeneralSolution(Arc<Expr>)

The general solution to a differential equation.

§

ParticularSolution(Arc<Expr>)

A particular solution to a differential equation.

§

Fredholm(Arc<Expr>, Arc<Expr>, Arc<Expr>, Arc<Expr>)

A Fredholm integral equation.

§

Volterra(Arc<Expr>, Arc<Expr>, Arc<Expr>, Arc<Expr>)

A Volterra integral equation.

§

Apply(Arc<Expr>, Arc<Expr>)

Application of a function to an argument.

§

Tuple(Vec<Expr>)

A tuple of expressions.

§

Dag(Arc<DagNode>)

A node in a Directed Acyclic Graph (DAG) for expression sharing.

This is now the preferred representation for all expressions. When serialized, the DAG structure is preserved.

§

Distribution(Arc<dyn Distribution>)

A probability distribution.

§

Max(Arc<Expr>, Arc<Expr>)

Maximum of two expressions.

§

Quantity(Arc<UnitQuantity>)

A unified quantity with its value and unit string.

§

QuantityWithValue(Arc<Expr>, String)

A temporary representation of a value with a unit string, before unification.

§

CustomZero

👎Deprecated since 0.1.18: Please use the ‘UnaryList’ variant instead.
§

CustomString(String)

👎Deprecated since 0.1.18: Please use the ‘UnaryList’ variant instead.
§

CustomArcOne(Arc<Expr>)

👎Deprecated since 0.1.18: Please use the ‘UnaryList’ variant instead.
§

CustomArcTwo(Arc<Expr>, Arc<Expr>)

👎Deprecated since 0.1.18: Please use the ‘BinaryList’ variant instead.
§

CustomArcThree(Arc<Expr>, Arc<Expr>, Arc<Expr>)

👎Deprecated since 0.1.18: Please use the ‘NaryList’ variant instead.
§

CustomArcFour(Arc<Expr>, Arc<Expr>, Arc<Expr>, Arc<Expr>)

👎Deprecated since 0.1.18: Please use the ‘NaryList’ variant instead.
§

CustomArcFive(Arc<Expr>, Arc<Expr>, Arc<Expr>, Arc<Expr>, Arc<Expr>)

👎Deprecated since 0.1.18: Please use the ‘NaryList’ variant instead.
§

CustomVecOne(Vec<Expr>)

👎Deprecated since 0.1.18: Please use the ‘UnaryList’ variant instead.
§

CustomVecTwo(Vec<Expr>, Vec<Expr>)

👎Deprecated since 0.1.18: Please use the ‘BinaryList’ variant instead.
§

CustomVecThree(Vec<Expr>, Vec<Expr>, Vec<Expr>)

👎Deprecated since 0.1.18: Please use the ‘NaryList’ variant instead.
§

CustomVecFour(Vec<Expr>, Vec<Expr>, Vec<Expr>, Vec<Expr>)

👎Deprecated since 0.1.18: Please use the ‘NaryList’ variant instead.
§

CustomVecFive(Vec<Expr>, Vec<Expr>, Vec<Expr>, Vec<Expr>, Vec<Expr>)

👎Deprecated since 0.1.18: Please use the ‘NaryList’ variant instead.
§

UnaryList(String, Arc<Expr>)

Generic unary operation identified by a name.

This variant allows for extensible unary operations without modifying the Expr enum. Operations are registered in the DYNAMIC_OP_REGISTRY with their properties (associativity, commutativity, etc.). This is part of the plugin system and future-proofing strategy.

§Examples

use rssn::symbolic::core::{Expr, register_dynamic_op, DynamicOpProperties};
use std::sync::Arc;

// Register a custom operation
register_dynamic_op("my_func", DynamicOpProperties {
    name: "my_func".to_string(),
    description: "My custom function".to_string(),
    is_associative: false,
    is_commutative: false,
});

// Use it
let expr = Expr::UnaryList(
    "my_func".to_string(),
    Arc::new(Expr::Variable("x".to_string()))
);
§

BinaryList(String, Arc<Expr>, Arc<Expr>)

Generic binary operation identified by a name.

This variant allows for extensible binary operations without modifying the Expr enum. Operations are registered in the DYNAMIC_OP_REGISTRY with their properties.

§Examples

use rssn::symbolic::core::{Expr, register_dynamic_op, DynamicOpProperties};
use std::sync::Arc;

// Register a custom binary operation
register_dynamic_op("my_binop", DynamicOpProperties {
    name: "my_binop".to_string(),
    description: "My custom binary operation".to_string(),
    is_associative: true,
    is_commutative: true,
});

// Use it
let expr = Expr::BinaryList(
    "my_binop".to_string(),
    Arc::new(Expr::Variable("x".to_string())),
    Arc::new(Expr::Variable("y".to_string()))
);
§

NaryList(String, Vec<Expr>)

Generic n-ary operation identified by a name.

This variant allows for extensible n-ary operations without modifying the Expr enum. Operations are registered in the DYNAMIC_OP_REGISTRY with their properties. This is particularly useful for operations that can take a variable number of arguments.

§Examples

use rssn::symbolic::core::{Expr, register_dynamic_op, DynamicOpProperties};

// Register a custom n-ary operation
register_dynamic_op("my_nary", DynamicOpProperties {
    name: "my_nary".to_string(),
    description: "My custom n-ary operation".to_string(),
    is_associative: true,
    is_commutative: false,
});

// Use it
let expr = Expr::NaryList(
    "my_nary".to_string(),
    vec![
        Expr::Variable("a".to_string()),
        Expr::Variable("b".to_string()),
        Expr::Variable("c".to_string()),
    ]
);

Implementations§

Source§

impl Expr

Source

pub fn re(&self) -> Self

Source

pub fn im(&self) -> Self

Source

pub fn to_f64(&self) -> Option<f64>

Source

pub fn op(&self) -> DagOp

Returns the operation type of the expression in a unified way.

This method handles both regular expressions and DAG nodes, returning the operation regardless of internal representation.

§Returns
  • DagOp - The operation type corresponding to this expression
Source

pub fn children(&self) -> Vec<Expr>

Returns the children of the expression in a unified way.

This method handles both regular expressions and DAG nodes, returning the direct child expressions regardless of internal representation.

§Returns
  • Vec<Expr> - A vector containing the direct children of this expression
Source§

impl Expr

Source§

impl Expr

Source

pub fn pre_order_walk<F>(&self, f: &mut F)
where F: FnMut(&Expr),

Performs a pre-order traversal of the expression tree. It visits the current node first, then its children.

§Arguments
  • f - A mutable function that takes a reference to an Expr and is applied to each node during traversal
Source

pub fn post_order_walk<F>(&self, f: &mut F)
where F: FnMut(&Expr),

Performs a post-order traversal of the expression tree. It visits the children first, then the current node.

§Arguments
  • f - A mutable function that takes a reference to an Expr and is applied to each node during traversal
Source

pub fn in_order_walk<F>(&self, f: &mut F)
where F: FnMut(&Expr),

Performs an in-order traversal of the expression tree. For binary operators, it visits the left child, the node itself, then the right child. For other nodes, the behavior is adapted as it’s not strictly defined.

§Arguments
  • f - A mutable function that takes a reference to an Expr and is applied to each node during traversal
Source

pub fn normalize(&self) -> Expr

Source§

impl Expr

Source

pub fn new_constant(c: f64) -> Expr

Creates a new Constant expression, managed by the DAG.

Source

pub fn new_variable(name: &str) -> Expr

Creates a new Variable expression, managed by the DAG.

Source

pub fn new_bigint(i: BigInt) -> Expr

Creates a new BigInt expression, managed by the DAG.

Source

pub fn new_rational(r: BigRational) -> Expr

Creates a new Rational expression, managed by the DAG.

Source

pub fn new_pi() -> Expr

Creates a new Pi expression, managed by the DAG.

Source

pub fn new_e() -> Expr

Creates a new E expression, managed by the DAG.

Source

pub fn new_infinity() -> Expr

Creates a new Infinity expression, managed by the DAG.

Source

pub fn new_negative_infinity() -> Expr

Creates a new NegativeInfinity expression, managed by the DAG.

Source

pub fn new_sin<A>(a: A) -> Expr
where A: AsRef<Expr>,

Creates a new Sin expression, managed by the DAG.

Source

pub fn new_cos<A>(a: A) -> Expr
where A: AsRef<Expr>,

Creates a new Cos expression, managed by the DAG.

Source

pub fn new_tan<A>(a: A) -> Expr
where A: AsRef<Expr>,

Creates a new Tan expression, managed by the DAG.

Source

pub fn new_exp<A>(a: A) -> Expr
where A: AsRef<Expr>,

Creates a new Exp expression, managed by the DAG.

Source

pub fn new_log<A>(a: A) -> Expr
where A: AsRef<Expr>,

Creates a new Log expression, managed by the DAG.

Source

pub fn new_neg<A>(a: A) -> Expr
where A: AsRef<Expr>,

Creates a new Neg expression, managed by the DAG.

Source

pub fn new_abs<A>(a: A) -> Expr
where A: AsRef<Expr>,

Creates a new Abs expression, managed by the DAG.

Source

pub fn new_sqrt<A>(a: A) -> Expr
where A: AsRef<Expr>,

Creates a new Sqrt expression, managed by the DAG.

Source

pub fn new_transpose<A>(a: A) -> Expr
where A: AsRef<Expr>,

Creates a new Transpose expression, managed by the DAG.

Source

pub fn new_inverse<A>(a: A) -> Expr
where A: AsRef<Expr>,

Creates a new Inverse expression, managed by the DAG.

Source

pub fn new_sec<A>(a: A) -> Expr
where A: AsRef<Expr>,

Creates a new Sec expression, managed by the DAG.

Source

pub fn new_csc<A>(a: A) -> Expr
where A: AsRef<Expr>,

Creates a new Csc expression, managed by the DAG.

Source

pub fn new_cot<A>(a: A) -> Expr
where A: AsRef<Expr>,

Creates a new Cot expression, managed by the DAG.

Source

pub fn new_arcsin<A>(a: A) -> Expr
where A: AsRef<Expr>,

Creates a new ArcSin expression, managed by the DAG.

Source

pub fn new_arccos<A>(a: A) -> Expr
where A: AsRef<Expr>,

Creates a new ArcCos expression, managed by the DAG.

Source

pub fn new_arctan<A>(a: A) -> Expr
where A: AsRef<Expr>,

Creates a new ArcTan expression, managed by the DAG.

Source

pub fn new_arcsec<A>(a: A) -> Expr
where A: AsRef<Expr>,

Creates a new ArcSec expression, managed by the DAG.

Source

pub fn new_arccsc<A>(a: A) -> Expr
where A: AsRef<Expr>,

Creates a new ArcCsc expression, managed by the DAG.

Source

pub fn new_arccot<A>(a: A) -> Expr
where A: AsRef<Expr>,

Creates a new ArcCot expression, managed by the DAG.

Source

pub fn new_sinh<A>(a: A) -> Expr
where A: AsRef<Expr>,

Creates a new Sinh expression, managed by the DAG.

Source

pub fn new_cosh<A>(a: A) -> Expr
where A: AsRef<Expr>,

Creates a new Cosh expression, managed by the DAG.

Source

pub fn new_tanh<A>(a: A) -> Expr
where A: AsRef<Expr>,

Creates a new Tanh expression, managed by the DAG.

Source

pub fn new_sech<A>(a: A) -> Expr
where A: AsRef<Expr>,

Creates a new Sech expression, managed by the DAG.

Source

pub fn new_csch<A>(a: A) -> Expr
where A: AsRef<Expr>,

Creates a new Csch expression, managed by the DAG.

Source

pub fn new_coth<A>(a: A) -> Expr
where A: AsRef<Expr>,

Creates a new Coth expression, managed by the DAG.

Source

pub fn new_arcsinh<A>(a: A) -> Expr
where A: AsRef<Expr>,

Creates a new ArcSinh expression, managed by the DAG.

Source

pub fn new_arccosh<A>(a: A) -> Expr
where A: AsRef<Expr>,

Creates a new ArcCosh expression, managed by the DAG.

Source

pub fn new_arctanh<A>(a: A) -> Expr
where A: AsRef<Expr>,

Creates a new ArcTanh expression, managed by the DAG.

Source

pub fn new_arcsech<A>(a: A) -> Expr
where A: AsRef<Expr>,

Creates a new ArcSech expression, managed by the DAG.

Source

pub fn new_arccsch<A>(a: A) -> Expr
where A: AsRef<Expr>,

Creates a new ArcCsch expression, managed by the DAG.

Source

pub fn new_arccoth<A>(a: A) -> Expr
where A: AsRef<Expr>,

Creates a new ArcCoth expression, managed by the DAG.

Source

pub fn new_not<A>(a: A) -> Expr
where A: AsRef<Expr>,

Creates a new Not expression, managed by the DAG.

Source

pub fn new_floor<A>(a: A) -> Expr
where A: AsRef<Expr>,

Creates a new Floor expression, managed by the DAG.

Source

pub fn new_gamma<A>(a: A) -> Expr
where A: AsRef<Expr>,

Creates a new Gamma expression, managed by the DAG.

Source

pub fn new_erf<A>(a: A) -> Expr
where A: AsRef<Expr>,

Creates a new Erf expression, managed by the DAG.

Source

pub fn new_erfc<A>(a: A) -> Expr
where A: AsRef<Expr>,

Creates a new Erfc expression, managed by the DAG.

Source

pub fn new_erfi<A>(a: A) -> Expr
where A: AsRef<Expr>,

Creates a new Erfi expression, managed by the DAG.

Source

pub fn new_zeta<A>(a: A) -> Expr
where A: AsRef<Expr>,

Creates a new Zeta expression, managed by the DAG.

Source

pub fn new_digamma<A>(a: A) -> Expr
where A: AsRef<Expr>,

Creates a new Digamma expression, managed by the DAG.

Source

pub fn new_add<A, B>(a: A, b: B) -> Expr
where A: AsRef<Expr>, B: AsRef<Expr>,

Creates a new Add expression, managed by the DAG.

Source

pub fn new_sub<A, B>(a: A, b: B) -> Expr
where A: AsRef<Expr>, B: AsRef<Expr>,

Creates a new Sub expression, managed by the DAG.

Source

pub fn new_mul<A, B>(a: A, b: B) -> Expr
where A: AsRef<Expr>, B: AsRef<Expr>,

Creates a new Mul expression, managed by the DAG.

Source

pub fn new_div<A, B>(a: A, b: B) -> Expr
where A: AsRef<Expr>, B: AsRef<Expr>,

Creates a new Div expression, managed by the DAG.

Source

pub fn new_pow<A, B>(a: A, b: B) -> Expr
where A: AsRef<Expr>, B: AsRef<Expr>,

Creates a new Power expression, managed by the DAG.

Source

pub fn new_complex<A, B>(a: A, b: B) -> Expr
where A: AsRef<Expr>, B: AsRef<Expr>,

Creates a new Complex expression, managed by the DAG.

Source

pub fn new_matrix_mul<A, B>(a: A, b: B) -> Expr
where A: AsRef<Expr>, B: AsRef<Expr>,

Creates a new MatrixMul expression, managed by the DAG.

Source

pub fn new_matrix_vec_mul<A, B>(a: A, b: B) -> Expr
where A: AsRef<Expr>, B: AsRef<Expr>,

Creates a new MatrixVecMul expression, managed by the DAG.

Source

pub fn new_log_base<A, B>(a: A, b: B) -> Expr
where A: AsRef<Expr>, B: AsRef<Expr>,

Creates a new LogBase expression, managed by the DAG.

Source

pub fn new_atan2<A, B>(a: A, b: B) -> Expr
where A: AsRef<Expr>, B: AsRef<Expr>,

Creates a new Atan2 expression, managed by the DAG.

Source

pub fn new_xor<A, B>(a: A, b: B) -> Expr
where A: AsRef<Expr>, B: AsRef<Expr>,

Creates a new Xor expression, managed by the DAG.

Source

pub fn new_implies<A, B>(a: A, b: B) -> Expr
where A: AsRef<Expr>, B: AsRef<Expr>,

Creates a new Implies expression, managed by the DAG.

Source

pub fn new_equivalent<A, B>(a: A, b: B) -> Expr
where A: AsRef<Expr>, B: AsRef<Expr>,

Creates a new Equivalent expression, managed by the DAG.

Source

pub fn new_beta<A, B>(a: A, b: B) -> Expr
where A: AsRef<Expr>, B: AsRef<Expr>,

Creates a new Beta expression, managed by the DAG.

Source

pub fn new_bessel_j<A, B>(a: A, b: B) -> Expr
where A: AsRef<Expr>, B: AsRef<Expr>,

Creates a new BesselJ expression, managed by the DAG.

Source

pub fn new_bessel_y<A, B>(a: A, b: B) -> Expr
where A: AsRef<Expr>, B: AsRef<Expr>,

Creates a new BesselY expression, managed by the DAG.

Source

pub fn new_legendre_p<A, B>(a: A, b: B) -> Expr
where A: AsRef<Expr>, B: AsRef<Expr>,

Creates a new LegendreP expression, managed by the DAG.

Source

pub fn new_laguerre_l<A, B>(a: A, b: B) -> Expr
where A: AsRef<Expr>, B: AsRef<Expr>,

Creates a new LaguerreL expression, managed by the DAG.

Source

pub fn new_hermite_h<A, B>(a: A, b: B) -> Expr
where A: AsRef<Expr>, B: AsRef<Expr>,

Creates a new HermiteH expression, managed by the DAG.

Source

pub fn new_kronecker_delta<A, B>(a: A, b: B) -> Expr
where A: AsRef<Expr>, B: AsRef<Expr>,

Creates a new KroneckerDelta expression, managed by the DAG.

Source

pub fn new_apply<A, B>(a: A, b: B) -> Expr
where A: AsRef<Expr>, B: AsRef<Expr>,

Creates a new Apply expression, managed by the DAG.

Source

pub fn new_vector<I, T>(elements: I) -> Expr
where I: IntoIterator<Item = T>, T: AsRef<Expr>,

Creates a new Vector expression, managed by the DAG.

Source

pub fn new_and<I, T>(elements: I) -> Expr
where I: IntoIterator<Item = T>, T: AsRef<Expr>,

Creates a new And expression, managed by the DAG.

Source

pub fn new_or<I, T>(elements: I) -> Expr
where I: IntoIterator<Item = T>, T: AsRef<Expr>,

Creates a new Or expression, managed by the DAG.

Source

pub fn new_union<I, T>(elements: I) -> Expr
where I: IntoIterator<Item = T>, T: AsRef<Expr>,

Creates a new Union expression, managed by the DAG.

Source

pub fn new_polynomial<I, T>(elements: I) -> Expr
where I: IntoIterator<Item = T>, T: AsRef<Expr>,

Creates a new Polynomial expression, managed by the DAG.

Source

pub fn new_tuple<I, T>(elements: I) -> Expr
where I: IntoIterator<Item = T>, T: AsRef<Expr>,

Creates a new Tuple expression, managed by the DAG.

Source

pub fn new_matrix<I, J, T>(elements: I) -> Expr
where I: IntoIterator<Item = J>, J: IntoIterator<Item = T>, T: AsRef<Expr>,

Creates a new Matrix expression, managed by the DAG.

Source

pub fn new_predicate<I, T>(name: &str, args: I) -> Expr
where I: IntoIterator<Item = T>, T: AsRef<Expr>,

Source

pub fn new_forall<A>(var: &str, expr: A) -> Expr
where A: AsRef<Expr>,

Source

pub fn new_exists<A>(var: &str, expr: A) -> Expr
where A: AsRef<Expr>,

Source

pub fn new_interval<A, B>( lower: A, upper: B, incl_lower: bool, incl_upper: bool, ) -> Expr
where A: AsRef<Expr>, B: AsRef<Expr>,

Source

pub fn new_sparse_polynomial(p: SparsePolynomial) -> Expr

Source

pub fn new_custom_zero() -> Expr

👎Deprecated since 0.1.18: Please use the ‘UnaryList’ variant instead.
Source

pub fn new_custom_string(s: &str) -> Expr

👎Deprecated since 0.1.18: Please use the ‘UnaryList’ variant instead.
Source

pub fn new_custom_arc_one<A>(a: A) -> Expr
where A: AsRef<Expr>,

👎Deprecated since 0.1.18: Please use the ‘UnaryList’ variant instead.

Creates a new CustomArcOne expression, managed by the DAG.

Source

pub fn new_custom_arc_two<A, B>(a: A, b: B) -> Expr
where A: AsRef<Expr>, B: AsRef<Expr>,

👎Deprecated since 0.1.18: Please use the ‘BinaryList’ variant instead.

Creates a new CustomArcTwo expression, managed by the DAG.

Source

pub fn new_custom_arc_three<A, B, C>(a: A, b: B, c: C) -> Expr
where A: AsRef<Expr>, B: AsRef<Expr>, C: AsRef<Expr>,

👎Deprecated since 0.1.18: Please use the ‘NaryList’ variant instead.
Source

pub fn new_custom_arc_four<A, B, C, D>(a: A, b: B, c: C, d: D) -> Expr
where A: AsRef<Expr>, B: AsRef<Expr>, C: AsRef<Expr>, D: AsRef<Expr>,

👎Deprecated since 0.1.18: Please use the ‘NaryList’ variant instead.
Source

pub fn new_custom_arc_five<A, B, C, D, E>(a: A, b: B, c: C, d: D, e: E) -> Expr
where A: AsRef<Expr>, B: AsRef<Expr>, C: AsRef<Expr>, D: AsRef<Expr>, E: AsRef<Expr>,

👎Deprecated since 0.1.18: Please use the ‘NaryList’ variant instead.
Source

pub fn new_custom_vec_one<I, T>(elements: I) -> Expr
where I: IntoIterator<Item = T>, T: AsRef<Expr>,

👎Deprecated since 0.1.18: Please use the ‘NaryList’ variant instead.

Creates a new CustomVecOne expression, managed by the DAG.

Source

pub fn new_custom_vec_two<I, T>(elements: I) -> Expr
where I: IntoIterator<Item = T>, T: AsRef<Expr>,

👎Deprecated since 0.1.18: Please use the ‘NaryList’ variant instead.

Creates a new CustomVecTwo expression, managed by the DAG.

Source

pub fn new_custom_vec_three<I, T>(elements: I) -> Expr
where I: IntoIterator<Item = T>, T: AsRef<Expr>,

👎Deprecated since 0.1.18: Please use the ‘NaryList’ variant instead.

Creates a new CustomVecThree expression, managed by the DAG.

Source

pub fn new_custom_vec_four<I, T>(elements: I) -> Expr
where I: IntoIterator<Item = T>, T: AsRef<Expr>,

👎Deprecated since 0.1.18: Please use the ‘NaryList’ variant instead.

Creates a new CustomVecFour expression, managed by the DAG.

Source

pub fn new_custom_vec_five<I, T>(elements: I) -> Expr
where I: IntoIterator<Item = T>, T: AsRef<Expr>,

👎Deprecated since 0.1.18: Please use the ‘NaryList’ variant instead.

Creates a new CustomVecFive expression, managed by the DAG.

Source

pub fn is_dag(&self) -> bool

Checks if this expression is in DAG form.

§Returns
  • true if the expression is Expr::Dag, false otherwise
§Examples
use rssn::symbolic::core::Expr;

let dag_expr = Expr::new_variable("x");
assert!(dag_expr.is_dag());

let ast_expr = Expr::Constant(1.0);
assert!(!ast_expr.is_dag());
Source

pub fn to_dag(&self) -> Result<Expr, String>

Converts this expression to DAG form if not already.

This is a key function for the AST→DAG migration. It ensures that any expression, whether in old AST form or new DAG form, is converted to a canonical DAG representation.

§Returns
  • Ok(Expr::Dag) - The expression in DAG form
  • Err(String) - If conversion fails
§Examples
use rssn::symbolic::core::Expr;
use std::sync::Arc;

// Old AST form
let ast = Expr::Add(
    Arc::new(Expr::Variable("x".to_string())),
    Arc::new(Expr::Constant(1.0))
);

// Convert to DAG
let dag = ast.to_dag().unwrap();
assert!(dag.is_dag());
Source

pub fn to_dag_form(&mut self)

Converts this expression to DAG form in-place.

This is a convenience method that converts the expression to DAG form and replaces the current value.

§Examples
use rssn::symbolic::core::Expr;

let mut expr = Expr::Constant(1.0);
assert!(!expr.is_dag());

expr.to_dag_form();
assert!(expr.is_dag());
Source

pub fn to_ast(&self) -> Result<Expr, String>

Converts a DAG expression back to AST form (for serialization).

This is used internally for backward-compatible serialization. Note: This may fail for expressions that cannot be represented in AST form.

§Returns
  • Ok(Expr) - The expression in AST form
  • Err(String) - If conversion fails

Trait Implementations§

Source§

impl AsRef<Expr> for Expr

Source§

fn as_ref(&self) -> &Expr

Converts this type into a shared reference of the (usually inferred) input type.
Source§

impl Clone for 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 Expr

Source§

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

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

impl<'de> Deserialize<'de> for Expr

Source§

fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>
where __D: Deserializer<'de>,

Deserialize this value from the given Serde deserializer. Read more
Source§

impl Display for Expr

Source§

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

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

impl From<DagNode> for Expr

Source§

fn from(node: DagNode) -> Self

Converts to this type from the input type.
Source§

impl From<f64> for Expr

Source§

fn from(val: f64) -> Self

Converts to this type from the input type.
Source§

impl Hash for Expr

Source§

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

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

fn hash_slice<H>(data: &[Self], state: &mut H)
where H: Hasher, Self: Sized,

Feeds a slice of this type into the given Hasher. Read more
Source§

impl Mul<Expr> for Multivector

Source§

type Output = Multivector

The resulting type after applying the * operator.
Source§

fn mul(self, scalar: Expr) -> Self

Performs the * operation. Read more
Source§

impl Ord for Expr

Source§

fn cmp(&self, other: &Self) -> 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,

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

impl PartialEq for 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 PartialOrd for Expr

Source§

fn partial_cmp(&self, other: &Self) -> 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

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

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

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

Tests greater than or equal to (for self and other) and is used by the >= operator. Read more
Source§

impl Serialize for Expr

Source§

fn serialize<__S>(&self, __serializer: __S) -> Result<__S::Ok, __S::Error>
where __S: Serializer,

Serialize this value into the given Serde serializer. Read more
Source§

impl Eq for Expr

Auto Trait Implementations§

§

impl Freeze for Expr

§

impl !RefUnwindSafe for Expr

§

impl Send for Expr

§

impl Sync for Expr

§

impl Unpin for Expr

§

impl !UnwindSafe for Expr

Blanket Implementations§

Source§

impl<T> AlignerFor<1> for T

Source§

type Aligner = AlignTo1<T>

The AlignTo* type which aligns Self to ALIGNMENT.
Source§

impl<T> AlignerFor<1024> for T

Source§

type Aligner = AlignTo1024<T>

The AlignTo* type which aligns Self to ALIGNMENT.
Source§

impl<T> AlignerFor<128> for T

Source§

type Aligner = AlignTo128<T>

The AlignTo* type which aligns Self to ALIGNMENT.
Source§

impl<T> AlignerFor<16> for T

Source§

type Aligner = AlignTo16<T>

The AlignTo* type which aligns Self to ALIGNMENT.
Source§

impl<T> AlignerFor<16384> for T

Source§

type Aligner = AlignTo16384<T>

The AlignTo* type which aligns Self to ALIGNMENT.
Source§

impl<T> AlignerFor<2> for T

Source§

type Aligner = AlignTo2<T>

The AlignTo* type which aligns Self to ALIGNMENT.
Source§

impl<T> AlignerFor<2048> for T

Source§

type Aligner = AlignTo2048<T>

The AlignTo* type which aligns Self to ALIGNMENT.
Source§

impl<T> AlignerFor<256> for T

Source§

type Aligner = AlignTo256<T>

The AlignTo* type which aligns Self to ALIGNMENT.
Source§

impl<T> AlignerFor<32> for T

Source§

type Aligner = AlignTo32<T>

The AlignTo* type which aligns Self to ALIGNMENT.
Source§

impl<T> AlignerFor<32768> for T

Source§

type Aligner = AlignTo32768<T>

The AlignTo* type which aligns Self to ALIGNMENT.
Source§

impl<T> AlignerFor<4> for T

Source§

type Aligner = AlignTo4<T>

The AlignTo* type which aligns Self to ALIGNMENT.
Source§

impl<T> AlignerFor<4096> for T

Source§

type Aligner = AlignTo4096<T>

The AlignTo* type which aligns Self to ALIGNMENT.
Source§

impl<T> AlignerFor<512> for T

Source§

type Aligner = AlignTo512<T>

The AlignTo* type which aligns Self to ALIGNMENT.
Source§

impl<T> AlignerFor<64> for T

Source§

type Aligner = AlignTo64<T>

The AlignTo* type which aligns Self to ALIGNMENT.
Source§

impl<T> AlignerFor<8> for T

Source§

type Aligner = AlignTo8<T>

The AlignTo* type which aligns Self to ALIGNMENT.
Source§

impl<T> AlignerFor<8192> for T

Source§

type Aligner = AlignTo8192<T>

The AlignTo* type which aligns Self to ALIGNMENT.
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> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<Q, K> Comparable<K> for Q
where Q: Ord + ?Sized, K: Borrow<Q> + ?Sized,

Source§

fn compare(&self, key: &K) -> Ordering

Compare self to key and return their ordering.
Source§

impl<Q, K> Equivalent<K> for Q
where Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,

Source§

fn equivalent(&self, key: &K) -> bool

Checks if this value is equivalent to the given key. Read more
Source§

impl<Q, K> Equivalent<K> for Q
where Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,

Source§

fn equivalent(&self, key: &K) -> bool

Compare self to key and return true if they are equal.
Source§

impl<Q, K> Equivalent<K> for Q
where Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,

Source§

fn equivalent(&self, key: &K) -> bool

Checks if this value is equivalent to the given key. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, W> HasTypeWitness<W> for T
where W: MakeTypeWitness<Arg = T>, T: ?Sized,

Source§

const WITNESS: W = W::MAKE

A constant of the type witness
Source§

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

Source§

const TYPE_EQ: TypeEq<T, <T as Identity>::Type> = TypeEq::NEW

Proof that Self is the same type as Self::Type, provides methods for casting between Self and Self::Type.
Source§

type Type = T

The same type as Self, used to emulate type equality bounds (T == U) with associated type equality constraints (T: Identity<Type = U>).
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> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self>

Converts self into a Left variant of Either<Self, Self> if into_left is true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

Converts self into a Left variant of Either<Self, Self> if into_left(&self) returns true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

impl<T> Pointable for T

Source§

const ALIGN: usize

The alignment of pointer.
Source§

type Init = T

The type for initializers.
Source§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
Source§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
Source§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
Source§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
Source§

impl<'a, T> RCowCompatibleRef<'a> for T
where T: Clone + 'a,

Source§

type RefC = &'a T

The (preferably) ffi-safe equivalent of &Self.
Source§

type ROwned = T

The owned version of Self::RefC.
Source§

fn as_c_ref(from: &'a T) -> <T as RCowCompatibleRef<'a>>::RefC

Converts a reference to an FFI-safe type
Source§

fn as_rust_ref(from: <T as RCowCompatibleRef<'a>>::RefC) -> &'a T

Converts an FFI-safe type to a reference
Source§

impl<S> ROExtAcc for S

Source§

fn f_get<F>(&self, offset: FieldOffset<S, F, Aligned>) -> &F

Gets a reference to a field, determined by offset. Read more
Source§

fn f_get_mut<F>(&mut self, offset: FieldOffset<S, F, Aligned>) -> &mut F

Gets a muatble reference to a field, determined by offset. Read more
Source§

fn f_get_ptr<F, A>(&self, offset: FieldOffset<S, F, A>) -> *const F

Gets a const pointer to a field, the field is determined by offset. Read more
Source§

fn f_get_mut_ptr<F, A>(&mut self, offset: FieldOffset<S, F, A>) -> *mut F

Gets a mutable pointer to a field, determined by offset. Read more
Source§

impl<S> ROExtOps<Aligned> for S

Source§

fn f_replace<F>(&mut self, offset: FieldOffset<S, F, Aligned>, value: F) -> F

Replaces a field (determined by offset) with value, returning the previous value of the field. Read more
Source§

fn f_swap<F>(&mut self, offset: FieldOffset<S, F, Aligned>, right: &mut S)

Swaps a field (determined by offset) with the same field in right. Read more
Source§

fn f_get_copy<F>(&self, offset: FieldOffset<S, F, Aligned>) -> F
where F: Copy,

Gets a copy of a field (determined by offset). The field is determined by offset. Read more
Source§

impl<S> ROExtOps<Unaligned> for S

Source§

fn f_replace<F>(&mut self, offset: FieldOffset<S, F, Unaligned>, value: F) -> F

Replaces a field (determined by offset) with value, returning the previous value of the field. Read more
Source§

fn f_swap<F>(&mut self, offset: FieldOffset<S, F, Unaligned>, right: &mut S)

Swaps a field (determined by offset) with the same field in right. Read more
Source§

fn f_get_copy<F>(&self, offset: FieldOffset<S, F, Unaligned>) -> F
where F: Copy,

Gets a copy of a field (determined by offset). The field is determined by offset. Read more
Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

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

Source§

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

Compares the address of self with the address of other. Read more
Source§

fn piped<F, U>(self, f: F) -> U
where F: FnOnce(Self) -> U, Self: Sized,

Emulates the pipeline operator, allowing method syntax in more places. Read more
Source§

fn piped_ref<'a, F, U>(&'a self, f: F) -> U
where F: FnOnce(&'a Self) -> U,

The same as piped except that the function takes &Self Useful for functions that take &Self instead of Self. Read more
Source§

fn piped_mut<'a, F, U>(&'a mut self, f: F) -> U
where F: FnOnce(&'a mut Self) -> U,

The same as piped, except that the function takes &mut Self. Useful for functions that take &mut Self instead of Self.
Source§

fn mutated<F>(self, f: F) -> Self
where F: FnOnce(&mut Self), Self: Sized,

Mutates self using a closure taking self by mutable reference, passing it along the method chain. Read more
Source§

fn observe<F>(self, f: F) -> Self
where F: FnOnce(&Self), Self: Sized,

Observes the value of self, passing it along unmodified. Useful in long method chains. Read more
Source§

fn into_<T>(self) -> T
where Self: Into<T>,

Performs a conversion with Into. using the turbofish .into_::<_>() syntax. Read more
Source§

fn as_ref_<T>(&self) -> &T
where Self: AsRef<T>, T: ?Sized,

Performs a reference to reference conversion with AsRef, using the turbofish .as_ref_::<_>() syntax. Read more
Source§

fn as_mut_<T>(&mut self) -> &mut T
where Self: AsMut<T>, T: ?Sized,

Performs a mutable reference to mutable reference conversion with AsMut, using the turbofish .as_mut_::<_>() syntax. Read more
Source§

fn drop_(self)
where Self: Sized,

Drops self using method notation. Alternative to std::mem::drop. Read more
Source§

impl<SS, SP> SupersetOf<SS> for SP
where SS: SubsetOf<SP>,

Source§

fn to_subset(&self) -> Option<SS>

The inverse inclusion map: attempts to construct self from the equivalent element of its superset. Read more
Source§

fn is_in_subset(&self) -> bool

Checks if self is actually part of its subset T (and can be converted to it).
Source§

fn to_subset_unchecked(&self) -> SS

Use with care! Same as self.to_subset but without any property checks. Always succeeds.
Source§

fn from_subset(element: &SS) -> SP

The inclusion map: converts self to the equivalent element of its superset.
Source§

impl<SS, SP> SupersetOf<SS> for SP
where SS: SubsetOf<SP>,

Source§

fn to_subset(&self) -> Option<SS>

The inverse inclusion map: attempts to construct self from the equivalent element of its superset. Read more
Source§

fn is_in_subset(&self) -> bool

Checks if self is actually part of its subset T (and can be converted to it).
Source§

unsafe fn to_subset_unchecked(&self) -> SS

Use with care! Same as self.to_subset but without any property checks. Always succeeds.
Source§

fn from_subset(element: &SS) -> SP

The inclusion map: converts self to the equivalent element of its superset.
Source§

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

Source§

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> ToString for T
where T: Display + ?Sized,

Source§

fn to_string(&self) -> String

Converts the given value to a String. Read more
Source§

impl<This> TransmuteElement for This
where This: ?Sized,

Source§

unsafe fn transmute_element<T>(self) -> Self::TransmutedPtr
where Self: CanTransmuteElement<T>,

Transmutes the element type of this pointer.. Read more
Source§

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

Source§

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>,

Source§

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.
Source§

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

Source§

type Type = T

This is always Self.
Source§

fn into_type(self) -> Self::Type
where Self: Sized, Self::Type: Sized,

Converts a value back to the original type.
Source§

fn as_type(&self) -> &Self::Type

Converts a reference back to the original type.
Source§

fn as_type_mut(&mut self) -> &mut Self::Type

Converts a mutable reference back to the original type.
Source§

fn into_type_box(self: Box<Self>) -> Box<Self::Type>

Converts a box back to the original type.
Source§

fn into_type_arc(this: Arc<Self>) -> Arc<Self::Type>

Converts an Arc back to the original type. Read more
Source§

fn into_type_rc(this: Rc<Self>) -> Rc<Self::Type>

Converts an Rc back to the original type. Read more
Source§

fn from_type(this: Self::Type) -> Self
where Self: Sized, Self::Type: Sized,

Converts a value back to the original type.
Source§

fn from_type_ref(this: &Self::Type) -> &Self

Converts a reference back to the original type.
Source§

fn from_type_mut(this: &mut Self::Type) -> &mut Self

Converts a mutable reference back to the original type.
Source§

fn from_type_box(this: Box<Self::Type>) -> Box<Self>

Converts a box back to the original type.
Source§

fn from_type_arc(this: Arc<Self::Type>) -> Arc<Self>

Converts an Arc back to the original type.
Source§

fn from_type_rc(this: Rc<Self::Type>) -> Rc<Self>

Converts an Rc back to the original type.
Source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V

Source§

impl<T> DeserializeOwned for T
where T: for<'de> Deserialize<'de>,

Source§

impl<T> Scalar for T
where T: 'static + Clone + PartialEq + Debug,

Source§

impl<T> Scalar for T
where T: 'static + Clone + PartialEq + Debug,

Source§

impl<T> SendAlias for T

Source§

impl<T> SyncAlias for T

Source§

impl<This> ValidTag_Bounds for This
where This: Debug + Clone + PartialEq,