pub struct Context {
    pub functions: HashMap<String, (Vec<String>, Box<Expression>)>,
    pub variables: HashMap<String, Box<Expression>>,
    pub rounding: Rounding,
    pub angle_unit: AngleUnit,
    pub depth_limit: DepthLimit,
}
Expand description

Contains user-defined functions and constants.

Fields

functions: HashMap<String, (Vec<String>, Box<Expression>)>

Function declared by the user at runtime.

variables: HashMap<String, Box<Expression>>

Variables declared by the user at runtime.

rounding: Rounding

The decimal digits to display.

angle_unit: AngleUnit

The angle unit to use.

depth_limit: DepthLimit

Depth limit for recursion control. .

Implementations

Generates an empty context with default settings.

Generates an empty context.

Add all the functions and variables of another context to this one.

Add a function to the user-defined ones.

Add a variable to the user-defined ones.

Returns a user-defined function given an identifier.

Returns a user-defined constant given an identifier.

Returns true if the identifier refers to a user-defined function.

Returns true if the identifier refers to a user-defined constant.

Trait Implementations

Returns a copy of the value. Read more

Performs copy-assignment from source. Read more

Formats the value using the given formatter. Read more

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

Immutably borrows from an owned value. Read more

Mutably borrows from an owned value. Read more

Returns the argument unchanged.

Calls U::from(self).

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

The resulting type after obtaining ownership.

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

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

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.