[−][src]Struct jrsonnet_evaluator::EvaluationState
Maintains stack trace and import resolution
Implementations
impl EvaluationState
[src]
pub fn add_file(&self, path: Rc<PathBuf>, source_code: Rc<str>) -> Result<()>
[src]
Parses and adds file as loaded
pub fn add_parsed_file(
&self,
name: Rc<PathBuf>,
source_code: Rc<str>,
parsed: LocExpr
) -> Result<()>
[src]
&self,
name: Rc<PathBuf>,
source_code: Rc<str>,
parsed: LocExpr
) -> Result<()>
Adds file by source code and parsed expr
pub fn get_source(&self, name: &PathBuf) -> Option<Rc<str>>
[src]
pub fn map_source_locations(
&self,
file: &PathBuf,
locs: &[usize]
) -> Vec<CodeLocation>
[src]
&self,
file: &PathBuf,
locs: &[usize]
) -> Vec<CodeLocation>
pub fn with_stdlib(&self) -> &Self
[src]
Adds standard library global variable (std) to this evaluator
pub fn create_default_context(&self) -> Result<Context>
[src]
Creates context with all passed global variables
pub fn push<T>(
&self,
e: &ExprLocation,
frame_desc: impl FnOnce() -> String,
f: impl FnOnce() -> Result<T>
) -> Result<T>
[src]
&self,
e: &ExprLocation,
frame_desc: impl FnOnce() -> String,
f: impl FnOnce() -> Result<T>
) -> Result<T>
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<Rc<str>>
[src]
pub fn manifest_multi(&self, val: Val) -> Result<Vec<(Rc<str>, Rc<str>)>>
[src]
pub fn manifest_stream(&self, val: Val) -> Result<Vec<Rc<str>>>
[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
pub fn settings(&self) -> Ref<'_, EvaluationSettings>
[src]
pub fn settings_mut(&self) -> RefMut<'_, EvaluationSettings>
[src]
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: Rc<str>
) -> Result<Val>
[src]
&self,
source: Rc<PathBuf>,
code: Rc<str>
) -> Result<Val>
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: Rc<str>, value: Val)
[src]
pub fn add_ext_str(&self, name: Rc<str>, value: Rc<str>)
[src]
pub fn add_ext_code(&self, name: Rc<str>, code: Rc<str>) -> Result<()>
[src]
pub fn add_tla(&self, name: Rc<str>, value: Val)
[src]
pub fn add_tla_str(&self, name: Rc<str>, value: Rc<str>)
[src]
pub fn add_tla_code(&self, name: Rc<str>, code: Rc<str>) -> Result<()>
[src]
pub fn resolve_file(
&self,
from: &PathBuf,
path: &PathBuf
) -> Result<Rc<PathBuf>>
[src]
&self,
from: &PathBuf,
path: &PathBuf
) -> Result<Rc<PathBuf>>
pub fn load_file_contents(&self, path: &PathBuf) -> Result<Rc<str>>
[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: Rc<str>, 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]
fn clone(&self) -> EvaluationState
[src]
fn clone_from(&mut self, source: &Self)
1.0.0[src]
impl Default for EvaluationState
[src]
fn default() -> EvaluationState
[src]
Auto Trait Implementations
impl !RefUnwindSafe for EvaluationState
impl !Send for EvaluationState
impl !Sync for EvaluationState
impl Unpin for EvaluationState
impl !UnwindSafe for EvaluationState
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T> ToOwned for T where
T: Clone,
[src]
T: Clone,
type Owned = T
The resulting type after obtaining ownership.
fn to_owned(&self) -> T
[src]
fn clone_into(&self, target: &mut T)
[src]
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,