Struct jrsonnet_evaluator::EvaluationState[][src]

pub struct EvaluationState(_);

Maintains stack trace and import resolution

Implementations

impl EvaluationState[src]

pub fn add_file(&self, path: Rc<PathBuf>, source_code: IStr) -> Result<()>[src]

Parses and adds file as loaded

pub fn add_parsed_file(
    &self,
    name: Rc<PathBuf>,
    source_code: IStr,
    parsed: LocExpr
) -> Result<()>
[src]

Adds file by source code and parsed expr

pub fn get_source(&self, name: &PathBuf) -> Option<IStr>[src]

pub fn map_source_locations(
    &self,
    file: &PathBuf,
    locs: &[usize]
) -> Vec<CodeLocation>
[src]

pub fn with_stdlib(&self) -> &Self[src]

Adds standard library global variable (std) to this evaluator

pub fn create_default_context(&self) -> Context[src]

Creates context with all passed global variables

pub fn push<T>(
    &self,
    e: Option<&ExprLocation>,
    frame_desc: impl FnOnce() -> String,
    f: impl FnOnce() -> Result<T>
) -> Result<T>
[src]

Executes code creating a new stack frame

pub fn run_in_state<T>(&self, f: impl FnOnce() -> T) -> T[src]

Runs passed function in state (required if function needs to modify stack trace)

pub fn stringify_err(&self, e: &LocError) -> String[src]

pub fn manifest(&self, val: Val) -> Result<IStr>[src]

pub fn manifest_multi(&self, val: Val) -> Result<Vec<(IStr, IStr)>>[src]

pub fn manifest_stream(&self, val: Val) -> Result<Vec<IStr>>[src]

pub fn with_tla(&self, val: Val) -> Result<Val>[src]

If passed value is function then call with set TLA

impl EvaluationState[src]

Internals

impl EvaluationState[src]

Raw methods evaluate passed values but don’t perform TLA execution

pub fn evaluate_file_raw(&self, name: &PathBuf) -> Result<Val>[src]

pub fn evaluate_file_raw_nocwd(&self, name: &PathBuf) -> Result<Val>[src]

pub fn evaluate_snippet_raw(
    &self,
    source: Rc<PathBuf>,
    code: IStr
) -> Result<Val>
[src]

Parses and evaluates the given snippet

pub fn evaluate_expr_raw(&self, code: LocExpr) -> Result<Val>[src]

Evaluates the parsed expression

impl EvaluationState[src]

Settings utilities

pub fn add_ext_var(&self, name: IStr, value: Val)[src]

pub fn add_ext_str(&self, name: IStr, value: IStr)[src]

pub fn add_ext_code(&self, name: IStr, code: IStr) -> Result<()>[src]

pub fn add_tla(&self, name: IStr, value: Val)[src]

pub fn add_tla_str(&self, name: IStr, value: IStr)[src]

pub fn add_tla_code(&self, name: IStr, code: IStr) -> Result<()>[src]

pub fn resolve_file(
    &self,
    from: &PathBuf,
    path: &PathBuf
) -> Result<Rc<PathBuf>>
[src]

pub fn load_file_contents(&self, path: &PathBuf) -> Result<IStr>[src]

pub fn import_resolver(&self) -> Ref<'_, dyn ImportResolver>[src]

pub fn set_import_resolver(&self, resolver: Box<dyn ImportResolver>)[src]

pub fn add_native(&self, name: IStr, cb: Rc<NativeCallback>)[src]

pub fn manifest_format(&self) -> ManifestFormat[src]

pub fn set_manifest_format(&self, format: ManifestFormat)[src]

pub fn trace_format(&self) -> Ref<'_, dyn TraceFormat>[src]

pub fn set_trace_format(&self, format: Box<dyn TraceFormat>)[src]

pub fn max_trace(&self) -> usize[src]

pub fn set_max_trace(&self, trace: usize)[src]

pub fn max_stack(&self) -> usize[src]

pub fn set_max_stack(&self, trace: usize)[src]

Trait Implementations

impl Clone for EvaluationState[src]

impl Default for EvaluationState[src]

Auto Trait Implementations

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.