Struct rink::context::Context [] [src]

pub struct Context {
    pub dimensions: BTreeSet<Dim>,
    pub canonicalizations: BTreeMap<String, String>,
    pub units: BTreeMap<String, Number>,
    pub quantities: BTreeMap<Unit, String>,
    pub reverse: BTreeMap<Unit, String>,
    pub prefixes: Vec<(String, Number)>,
    pub definitions: BTreeMap<String, Expr>,
    pub docs: BTreeMap<String, String>,
    pub categories: BTreeMap<String, String>,
    pub category_names: BTreeMap<String, String>,
    pub datepatterns: Vec<Vec<DatePattern>>,
    pub substances: BTreeMap<String, Substance>,
    pub substance_symbols: BTreeMap<String, String>,
    pub temporaries: BTreeMap<String, Number>,
    pub short_output: bool,
    pub use_humanize: bool,
}

The evaluation context that contains unit definitions.

Fields

Methods

impl Context
[src]

Creates a new, empty context

Given a unit name, returns its value if it exists. Supports SI prefixes, plurals, bare dimensions like length, and quantities.

Given a unit name, try to return a canonical name (expanding aliases and such)

Describes a value's unit, gives true if the unit is reciprocal (e.g. you should prefix "1.0 / " or replace "multiply" with "divide" when rendering it).

impl Context
[src]

Evaluates an expression to compute its value, excluding -> conversions.

Evaluates an expression, include -> conversions.

impl Context
[src]

impl Context
[src]

Takes a parsed definitions.units from gnu_units::parse(). Prints if there are errors in the file.

Trait Implementations

impl Debug for Context
[src]

Formats the value using the given formatter.