pub struct State(_);
Expand description

Maintains stack trace and import resolution

Implementations§

source§

impl State

source

pub fn import_resolved_str(&self, path: SourcePath) -> Result<IStr>

Should only be called with path retrieved from [resolve_path], may panic otherwise

source

pub fn import_resolved_bin(&self, path: SourcePath) -> Result<IBytes>

Should only be called with path retrieved from [resolve_path], may panic otherwise

source

pub fn import_resolved(&self, path: SourcePath) -> Result<Val>

Should only be called with path retrieved from [resolve_path], may panic otherwise

source

pub fn import_from(&self, from: &SourcePath, path: &str) -> Result<Val>

Has same semantics as import 'path' called from from file

source

pub fn import(&self, path: impl AsRef<Path>) -> Result<Val>

source

pub fn create_default_context(&self, source: Source) -> Context

Creates context with all passed global variables

source

pub fn push<T>( e: CallLocation<'_>, frame_desc: impl FnOnce() -> String, f: impl FnOnce() -> Result<T> ) -> Result<T>

Executes code creating a new stack frame

source

pub fn push_val( &self, e: &ExprLocation, frame_desc: impl FnOnce() -> String, f: impl FnOnce() -> Result<Val> ) -> Result<Val>

Executes code creating a new stack frame

source

pub fn push_description<T>( frame_desc: impl FnOnce() -> String, f: impl FnOnce() -> Result<T> ) -> Result<T>

Executes code creating a new stack frame

source§

impl State

Internals

source§

impl State

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

source

pub fn evaluate_snippet( &self, name: impl Into<IStr>, code: impl Into<IStr> ) -> Result<Val>

Parses and evaluates the given snippet

source§

impl State

Settings utilities

source

pub fn resolve_from(&self, from: &SourcePath, path: &str) -> Result<SourcePath>

source

pub fn resolve(&self, path: impl AsRef<Path>) -> Result<SourcePath>

source

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

source

pub fn set_import_resolver(&self, resolver: impl ImportResolver)

source

pub fn context_initializer(&self) -> Ref<'_, dyn ContextInitializer>

source

pub fn set_context_initializer(&self, initializer: impl ContextInitializer)

Trait Implementations§

source§

impl Clone for State

source§

fn clone(&self) -> State

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
source§

impl Default for State

source§

fn default() -> State

Returns the “default value” for a type. Read more
source§

impl Trace for State

source§

fn trace(&self, tracer: &mut Tracer<'_>)

Define how to visit values referred by this value. Read more
source§

fn is_type_tracked() -> bool

Whether this type should be tracked by the collector. Read more

Auto Trait Implementations§

§

impl !RefUnwindSafe for State

§

impl !Send for State

§

impl !Sync for State

§

impl Unpin for State

§

impl !UnwindSafe for State

Blanket Implementations§

source§

impl<T> Any for Twhere T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for Twhere T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for Twhere 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 Twhere 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> ToOwned for Twhere 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 Twhere 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 Twhere 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.