Crate fend_core

Source
Expand description

This library implements most of the features of fend.

§Example

extern crate fend_core;

fn main() {
    let mut context = fend_core::Context::new();
    let result = fend_core::evaluate("1 + 1", &mut context).unwrap();
    assert_eq!(result.get_main_result(), "2");
}

Modules§

json
This module is not meant to be used by other crates. It may change or be removed at any point.
test_utils
Used by unit and integration tests

Structs§

Completion
Context
This struct contains fend’s current context, including some settings as well as stored variables.
FendResult
This contains the result of a computation.
SpanRef

Enums§

CustomUnitAttribute
These attributes make is possible to change the behaviour of custom units
DecimalSeparatorStyle
This controls decimal and thousands separators.
SpanKind

Traits§

ExchangeRateFn
An exchange rate handler.
Interrupt
This trait controls fend’s interrupt functionality.

Functions§

evaluate
This function evaluates a string using the given context. Any evaluation using this function cannot be interrupted.
evaluate_preview_with_interrupt
Evaluate the given string to use as a live preview.
evaluate_with_interrupt
This function evaluates a string using the given context and the provided Interrupt object.
get_completions_for_prefix
get_version
Returns the current version of fend-core.
substitute_inline_fend_expressions
Evaluates fend syntax embedded in Markdown or similarly-formatted strings.