Skip to main content

ExecState

Struct ExecState 

Source
pub struct ExecState<P>
where P: ProcessManager,
{ pub type_env: TypeSnapshot, /* private fields */ }
Expand description

Execution state for one script run. Public so hosts can register functions and introspect listings; all fields stay crate-private so the scope, recursion-budget, and task invariants cannot be broken from outside.

Fields§

§type_env: TypeSnapshot

Name directory for type resolution: startup descriptors plus the run’s host descriptors. Embedded snapshot so LSP queries types without instantiating ExecState<P>. Each entry carries its owning module ("" for startup globals).

Implementations§

Source§

impl<P> ExecState<P>
where P: ProcessManager,

Source

pub fn register_module(&mut self, module: HostModule<P>)

Register one HostModule: every function becomes callable as MODULE::NAME, every type joins the run’s name directory.

Source

pub fn list_functions(&self) -> Vec<FuncMeta>

All visible functions: natives plus hosts plus current DSL definitions.

Source

pub fn describe_function(&self, name: &str) -> Option<Value>

Describe one function by name, or None when unknown.

Source

pub fn pure_function_table( &self, ) -> Arc<HashMap<String, HashMap<String, Arc<dyn Fn(Vec<Value>) -> Result<Value, Diagnostic> + Send + Sync>>>> ⓘ

Shared snapshot of every registered pure function for placeholder and host driven expansion. Public so host crates resolve calls through the live registry instead of hardcoding module or function names. Cloning the Arc never copies the map.

Source§

impl<P> ExecState<P>
where P: ProcessManager,

Source

pub fn resolve_tag(&self, name: &str) -> Result<TypeTag, Diagnostic>

Resolve a source-level type name via live alias targets. Impure wrapper around the pure snapshot query: derives targets from import state, then delegates to TypeSnapshot::resolve_tag_with_targets so LSP and runtime share one owner.

Source

pub fn resolve_tag_for_unit( &self, unit: &str, name: &str, ) -> Result<TypeTag, Diagnostic>

Unit-scoped resolution for checkers holding only &ExecState. Derives live targets for unit, then delegates to the snapshot.

Source

pub fn register_type(&mut self, descriptor: &'static TypeDescriptor)

Explicit delegation to the embedded snapshot: ExecState is not a smart pointer to TypeSnapshot, so each forwarded query names its owner instead of relying on Deref coercion.

Source

pub fn is_known_type(&self, name: &str) -> bool

Source

pub fn register_record_schema( &mut self, name: &'static str, fields: Arc<[Field]>, )

Source

pub fn schema_names(&self) -> Vec<String>

Source

pub fn alias_names(&self) -> Vec<String>

Source

pub fn alias_target(&self, name: &str) -> Option<String>

Source

pub fn resolve_tag_with_targets( &self, unit: &str, alias_targets: &HashMap<String, Vec<AliasTarget>>, exports: &HashMap<String, Vec<String>>, name: &str, ) -> Result<TypeTag, Diagnostic>

Source

pub fn check_declaration_tag( &self, what: &str, tag: &TypeTag, ) -> Result<(), Diagnostic>

Source

pub fn check_return_tag( &self, what: &str, tag: &TypeTag, ) -> Result<(), Diagnostic>

Source

pub fn describe_type(&self, name: &str) -> Option<&'static TypeDescriptor>

Source

pub fn type_names(&self) -> Vec<String>

Source

pub fn validate_function_type_tags(&self) -> Result<(), Diagnostic>

Fail fast when any registered function declares param or return type names outside the type directory. Runs once per run before the first step executes: param arity and LET coercion already check values at use time, but a typo’d returns label otherwise lives forever as a lie in DESCRIBE output and generated references. Unknown names bail listing every known type. A closed allowed set without a type is rejected too: the set only means something alongside the STRING check that enforces it, so hand-built entries cannot render a set they never check.

Auto Trait Implementations§

§

impl<P> !RefUnwindSafe for ExecState<P>

§

impl<P> !Sync for ExecState<P>

§

impl<P> !UnwindSafe for ExecState<P>

§

impl<P> Forget for ExecState<P>

§

impl<P> Freeze for ExecState<P>
where *const dyn WorkspaceFs is !null: Freeze, PhantomData<dyn WorkspaceFs>: Freeze, *const ArcInner<LazyGuardedTempDir> is !null: Freeze, PhantomData<ArcInner<LazyGuardedTempDir>>: Freeze, *const ArcInner<HashMap<String, String>> is !null: Freeze, PhantomData<ArcInner<HashMap<String, String>>>: Freeze, *const u8 is !null: Freeze, PhantomData<u8>: Freeze, PhantomData<Arc<HashMap<String, String>>>: Freeze, PhantomData<BgChild>: Freeze, PhantomData<ScopeSnapshot>: Freeze, *const ArcInner<Mutex<dyn Read + Send>> is !null: Freeze, PhantomData<ArcInner<Mutex<dyn Read + Send>>>: Freeze, *const ArcInner<Mutex<dyn Write + Send>> is !null: Freeze, PhantomData<ArcInner<Mutex<dyn Write + Send>>>: Freeze, PhantomData<(String, String)>: Freeze, PhantomData<(String, ())>: Freeze, PhantomData<(String, Arc<dyn RemoteRunner>)>: Freeze, *const ArcInner<Mutex<Vec<(String, String)>>> is !null: Freeze, PhantomData<ArcInner<Mutex<Vec<(String, String)>>>>: Freeze, *const ArcInner<Atomic<u64>> is !null: Freeze, PhantomData<ArcInner<Atomic<u64>>>: Freeze, PhantomData<String>: Freeze, *const ArcInner<Mutex<HashMap<(usize, usize), SlidingWindow>>> is !null: Freeze, PhantomData<ArcInner<Mutex<HashMap<(usize, usize), SlidingWindow>>>>: Freeze, *const ArcInner<Mutex<HashMap<usize, ExactCapture>>> is !null: Freeze, PhantomData<ArcInner<Mutex<HashMap<usize, ExactCapture>>>>: Freeze, PhantomData<HashMap<String, (TypeTag, Value)>>: Freeze, PhantomData<HashSet<String>>: Freeze, PhantomData<(String, HostTypeEntry)>: Freeze, PhantomData<(String, RecordSchemaEntry)>: Freeze, PhantomData<(String, HashMap<String, TypeTag>)>: Freeze, PhantomData<((String, TypeId), Arc<dyn Any + Send + Sync>)>: Freeze, *const ArcInner<Atomic<bool>> is !null: Freeze, PhantomData<ArcInner<Atomic<bool>>>: Freeze, *const ArcInner<CancelHub> is !null: Freeze, PhantomData<ArcInner<CancelHub>>: Freeze, *const ArcInner<Mutex<Option<Box<dyn BackgroundHandle>>>> is !null: Freeze, PhantomData<ArcInner<Mutex<Option<Box<dyn BackgroundHandle>>>>>: Freeze, *const ArcInner<Mutex<HashMap<u64, Arc<TaskEntry>>>> is !null: Freeze, PhantomData<ArcInner<Mutex<HashMap<u64, Arc<TaskEntry>>>>>: Freeze, PhantomData<(usize, Vec<KeeperGuard>)>: Freeze, PhantomData<(String, FuncEntry<P>)>: Freeze, PhantomData<ScopeFrame<P>>: Freeze, *const ArcInner<HashMap<String, HashMap<String, Arc<dyn Fn(Vec<Value>) -> Result<Value, Diagnostic> + Send + Sync>>>> is !null: Freeze, PhantomData<ArcInner<HashMap<String, HashMap<String, Arc<dyn Fn(Vec<Value>) -> Result<Value, Diagnostic> + Send + Sync>>>>>: Freeze, PhantomData<(String, (String, String))>: Freeze, PhantomData<GuardedPath>: Freeze, PhantomData<(String, ModuleRecord)>: Freeze, PhantomData<Option<String>>: Freeze, PhantomData<(String, HashMap<String, Vec<AliasTarget>>)>: Freeze, PhantomData<ScopeAliasFrame>: Freeze, PhantomData<CallAliasFrame>: Freeze, PhantomData<usize>: Freeze, PhantomData<((String, String), String)>: Freeze, PhantomData<(String, Option<ModuleFuncs>)>: Freeze, PhantomData<Vec<String>>: Freeze, PhantomData<P>: Freeze,

§

impl<P> Move for ExecState<P>

§

impl<P> Send for ExecState<P>
where BoxRaw<dyn WorkspaceFs>: Send, Arc<LazyGuardedTempDir>: Send, Arc<HashMap<String, String>>: Send, RawVecInner: Send, BoxRaw<dyn BackgroundHandle>: Send, Arc<Mutex<dyn Read + Send>>: Send, Arc<Mutex<dyn Write + Send>>: Send, RawTable<(String, String)>: Send, RawTable<(String, ())>: Send, RawTable<(String, Arc<dyn RemoteRunner>)>: Send, Arc<Mutex<Vec<(String, String)>>>: Send, Arc<Atomic<u64>>: Send, Arc<Mutex<HashMap<(usize, usize), SlidingWindow>>>: Send, Arc<Mutex<HashMap<usize, ExactCapture>>>: Send, RawTable<(String, (TypeTag, Value))>: Send, RawTable<(String, HostTypeEntry)>: Send, RawTable<(String, RecordSchemaEntry)>: Send, RawTable<(String, HashMap<String, TypeTag>)>: Send, RawTable<((String, TypeId), Arc<dyn Any + Send + Sync>)>: Send, Arc<Atomic<bool>>: Send, Arc<CancelHub>: Send, Arc<Mutex<Option<Box<dyn BackgroundHandle>>>>: Send, Arc<Mutex<HashMap<u64, Arc<TaskEntry>>>>: Send, RawTable<(usize, Vec<KeeperGuard>)>: Send, RawTable<(String, FuncEntry<P>)>: Send, Arc<TypeTag>: Send, &'static TypeDescriptor: Send, Arc<[Field]>: Send, Arc<str>: Send, Arc<[TypeTag]>: Send, &'static [&'static str]: Send, &'static str: Send, &'static [ParamOption]: Send, &'static [Example]: Send, BoxRaw<GuardExpr>: Send, Value: Send, BoxRaw<Expr>: Send, BoxRaw<StepKind>: Send, Arc<dyn Fn(Vec<Value>) -> Result<Value, Diagnostic> + Send + Sync>: Send, Arc<dyn Fn(&mut StepCtx<'_, P>, Vec<Value>) -> Result<Value, Diagnostic> + Send + Sync>: Send, Arc<HashMap<String, HashMap<String, Arc<dyn Fn(Vec<Value>) -> Result<Value, Diagnostic> + Send + Sync>>>>: Send, RawTable<(String, (String, String))>: Send, RawTable<(String, ModuleRecord)>: Send, RawTable<(String, HashMap<String, Vec<AliasTarget>>)>: Send, RawTable<(String, Vec<AliasTarget>)>: Send, RawTable<((String, String), String)>: Send, RawTable<(String, Option<ModuleFuncs>)>: Send,

§

impl<P> Unpin for ExecState<P>

§

impl<P> UnsafeUnpin for ExecState<P>
where *const dyn WorkspaceFs is !null: UnsafeUnpin, PhantomData<dyn WorkspaceFs>: UnsafeUnpin, *const ArcInner<LazyGuardedTempDir> is !null: UnsafeUnpin, PhantomData<ArcInner<LazyGuardedTempDir>>: UnsafeUnpin, *const ArcInner<HashMap<String, String>> is !null: UnsafeUnpin, PhantomData<ArcInner<HashMap<String, String>>>: UnsafeUnpin, *const u8 is !null: UnsafeUnpin, PhantomData<u8>: UnsafeUnpin, PhantomData<Arc<HashMap<String, String>>>: UnsafeUnpin, PhantomData<BgChild>: UnsafeUnpin, PhantomData<ScopeSnapshot>: UnsafeUnpin, *const ArcInner<Mutex<dyn Read + Send>> is !null: UnsafeUnpin, PhantomData<ArcInner<Mutex<dyn Read + Send>>>: UnsafeUnpin, *const ArcInner<Mutex<dyn Write + Send>> is !null: UnsafeUnpin, PhantomData<ArcInner<Mutex<dyn Write + Send>>>: UnsafeUnpin, PhantomData<(String, String)>: UnsafeUnpin, PhantomData<(String, ())>: UnsafeUnpin, PhantomData<(String, Arc<dyn RemoteRunner>)>: UnsafeUnpin, *const ArcInner<Mutex<Vec<(String, String)>>> is !null: UnsafeUnpin, PhantomData<ArcInner<Mutex<Vec<(String, String)>>>>: UnsafeUnpin, *const ArcInner<Atomic<u64>> is !null: UnsafeUnpin, PhantomData<ArcInner<Atomic<u64>>>: UnsafeUnpin, PhantomData<String>: UnsafeUnpin, *const ArcInner<Mutex<HashMap<(usize, usize), SlidingWindow>>> is !null: UnsafeUnpin, PhantomData<ArcInner<Mutex<HashMap<(usize, usize), SlidingWindow>>>>: UnsafeUnpin, *const ArcInner<Mutex<HashMap<usize, ExactCapture>>> is !null: UnsafeUnpin, PhantomData<ArcInner<Mutex<HashMap<usize, ExactCapture>>>>: UnsafeUnpin, PhantomData<HashMap<String, (TypeTag, Value)>>: UnsafeUnpin, PhantomData<HashSet<String>>: UnsafeUnpin, PhantomData<(String, HostTypeEntry)>: UnsafeUnpin, PhantomData<(String, RecordSchemaEntry)>: UnsafeUnpin, PhantomData<(String, HashMap<String, TypeTag>)>: UnsafeUnpin, PhantomData<((String, TypeId), Arc<dyn Any + Send + Sync>)>: UnsafeUnpin, *const ArcInner<Atomic<bool>> is !null: UnsafeUnpin, PhantomData<ArcInner<Atomic<bool>>>: UnsafeUnpin, *const ArcInner<CancelHub> is !null: UnsafeUnpin, PhantomData<ArcInner<CancelHub>>: UnsafeUnpin, *const ArcInner<Mutex<Option<Box<dyn BackgroundHandle>>>> is !null: UnsafeUnpin, PhantomData<ArcInner<Mutex<Option<Box<dyn BackgroundHandle>>>>>: UnsafeUnpin, *const ArcInner<Mutex<HashMap<u64, Arc<TaskEntry>>>> is !null: UnsafeUnpin, PhantomData<ArcInner<Mutex<HashMap<u64, Arc<TaskEntry>>>>>: UnsafeUnpin, PhantomData<(usize, Vec<KeeperGuard>)>: UnsafeUnpin, PhantomData<(String, FuncEntry<P>)>: UnsafeUnpin, PhantomData<ScopeFrame<P>>: UnsafeUnpin, *const ArcInner<HashMap<String, HashMap<String, Arc<dyn Fn(Vec<Value>) -> Result<Value, Diagnostic> + Send + Sync>>>> is !null: UnsafeUnpin, PhantomData<ArcInner<HashMap<String, HashMap<String, Arc<dyn Fn(Vec<Value>) -> Result<Value, Diagnostic> + Send + Sync>>>>>: UnsafeUnpin, PhantomData<(String, (String, String))>: UnsafeUnpin, PhantomData<GuardedPath>: UnsafeUnpin, PhantomData<(String, ModuleRecord)>: UnsafeUnpin, PhantomData<Option<String>>: UnsafeUnpin, PhantomData<(String, HashMap<String, Vec<AliasTarget>>)>: UnsafeUnpin, PhantomData<ScopeAliasFrame>: UnsafeUnpin, PhantomData<CallAliasFrame>: UnsafeUnpin, PhantomData<usize>: UnsafeUnpin, PhantomData<((String, String), String)>: UnsafeUnpin, PhantomData<(String, Option<ModuleFuncs>)>: UnsafeUnpin, PhantomData<Vec<String>>: UnsafeUnpin, PhantomData<P>: UnsafeUnpin,

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> Downcast for T
where T: Any,

Source§

fn into_any(self: Box<T>) -> Box<dyn Any>

Convert Box<dyn Trait> (where Trait: Downcast) to Box<dyn Any>. Box<dyn Any> can then be further downcast into Box<ConcreteType> where ConcreteType implements Trait.
Source§

fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>

Convert Rc<Trait> (where Trait: Downcast) to Rc<Any>. Rc<Any> can then be further downcast into Rc<ConcreteType> where ConcreteType implements Trait.
Source§

fn as_any(&self) -> &(dyn Any + 'static)

Convert &Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot generate &Any’s vtable from &Trait’s.
Source§

fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)

Convert &mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot generate &mut Any’s vtable from &mut Trait’s.
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self> ⓘ

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self> ⓘ

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
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

Source§

type Output = T

Should always be Self
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

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.
Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self> ⓘ
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self> ⓘ

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more