Struct numbat::Context

source ·
pub struct Context { /* private fields */ }

Implementations§

source§

impl Context

source

pub fn new(module_importer: impl ModuleImporter + Send + Sync + 'static) -> Self

source

pub fn new_without_importer() -> Self

source

pub fn set_debug(&mut self, activate: bool)

source

pub fn load_currency_module_on_demand(&mut self, yes: bool)

source

pub fn prefetch_exchange_rates()

Fill the currency exchange rate cache. This call is blocking.

source

pub fn set_exchange_rates(xml_content: &str)

source

pub fn variable_names(&self) -> impl Iterator<Item = String> + '_

source

pub fn function_names(&self) -> impl Iterator<Item = String> + '_

source

pub fn unit_names(&self) -> &[Vec<String>]

source

pub fn dimension_names(&self) -> &[String]

source

pub fn print_environment(&self) -> Markup

source

pub fn print_functions(&self) -> Markup

source

pub fn print_dimensions(&self) -> Markup

source

pub fn print_variables(&self) -> Markup

source

pub fn print_units(&self) -> Markup

source

pub fn get_completions_for<'a>( &self, word_part: &'a str, add_paren: bool ) -> impl Iterator<Item = String> + 'a

Gets completions for the given word_part

If add_paren is true, then an opening paren will be added to the end of function names

source

pub fn print_info_for_keyword(&mut self, keyword: &str) -> Markup

source

pub fn list_modules(&self) -> impl Iterator<Item = String>

source

pub fn dimension_registry(&self) -> &DimensionRegistry

source

pub fn base_units(&self) -> impl Iterator<Item = String> + '_

source

pub fn unit_representations( &self ) -> impl Iterator<Item = (String, (BaseRepresentation, UnitMetadata))> + '_

source

pub fn resolver(&self) -> &Resolver

source

pub fn interpret( &mut self, code: &str, code_source: CodeSource ) -> Result<(Vec<Statement>, InterpreterResult), NumbatError>

source

pub fn interpret_with_settings( &mut self, settings: &mut InterpreterSettings, code: &str, code_source: CodeSource ) -> Result<(Vec<Statement>, InterpreterResult), NumbatError>

source

pub fn print_diagnostic(&self, error: impl ErrorDiagnostic)

source

pub fn set_terminal_width(&mut self, width: Option<usize>)

Trait Implementations§

source§

impl Clone for Context

source§

fn clone(&self) -> Context

Returns a copy of the value. Read more
1.0.0 · source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more

Auto Trait Implementations§

Blanket Implementations§

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> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

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> Same for T

§

type Output = T

Should always be Self
source§

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

§

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, U> TryFrom<U> for T
where U: Into<T>,

§

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

§

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.