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: TypeSnapshotName 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,
impl<P> ExecState<P>where
P: ProcessManager,
Sourcepub fn register_module(&mut self, module: HostModule<P>)
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.
Sourcepub fn list_functions(&self) -> Vec<FuncMeta>
pub fn list_functions(&self) -> Vec<FuncMeta>
All visible functions: natives plus hosts plus current DSL definitions.
Sourcepub fn describe_function(&self, name: &str) -> Option<Value>
pub fn describe_function(&self, name: &str) -> Option<Value>
Describe one function by name, or None when unknown.
Sourcepub fn pure_function_table(
&self,
) -> Arc<HashMap<String, HashMap<String, Arc<dyn Fn(Vec<Value>) -> Result<Value, Diagnostic> + Send + Sync>>>> ⓘ
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,
impl<P> ExecState<P>where
P: ProcessManager,
Sourcepub fn resolve_tag(&self, name: &str) -> Result<TypeTag, Diagnostic>
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.
Sourcepub fn resolve_tag_for_unit(
&self,
unit: &str,
name: &str,
) -> Result<TypeTag, Diagnostic>
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.
Sourcepub fn register_type(&mut self, descriptor: &'static TypeDescriptor)
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.
pub fn is_known_type(&self, name: &str) -> bool
pub fn register_record_schema( &mut self, name: &'static str, fields: Arc<[Field]>, )
pub fn schema_names(&self) -> Vec<String>
pub fn alias_names(&self) -> Vec<String>
pub fn alias_target(&self, name: &str) -> Option<String>
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>
pub fn check_declaration_tag( &self, what: &str, tag: &TypeTag, ) -> Result<(), Diagnostic>
pub fn check_return_tag( &self, what: &str, tag: &TypeTag, ) -> Result<(), Diagnostic>
pub fn describe_type(&self, name: &str) -> Option<&'static TypeDescriptor>
pub fn type_names(&self) -> Vec<String>
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>where
P: Unpin,
Box<dyn WorkspaceFs>: Unpin,
Arc<LazyGuardedTempDir>: Unpin,
Arc<HashMap<String, String>>: Unpin,
*const u8 is !null: Unpin,
Box<dyn BackgroundHandle>: Unpin,
Arc<Mutex<dyn Read + Send>>: Unpin,
Arc<Mutex<dyn Write + Send>>: Unpin,
Arc<dyn RemoteRunner>: Unpin,
Arc<Mutex<Vec<(String, String)>>>: Unpin,
Arc<Atomic<u64>>: Unpin,
Arc<Mutex<HashMap<(usize, usize), SlidingWindow>>>: Unpin,
Arc<Mutex<HashMap<usize, ExactCapture>>>: Unpin,
Arc<TypeTag>: Unpin,
&'static TypeDescriptor: Unpin,
Arc<[Field]>: Unpin,
Arc<str>: Unpin,
Arc<[TypeTag]>: Unpin,
*mut (): Unpin,
*const (): Unpin,
Arc<dyn Any + Send + Sync>: Unpin,
Arc<Atomic<bool>>: Unpin,
Arc<CancelHub>: Unpin,
Arc<Mutex<Option<Box<dyn BackgroundHandle>>>>: Unpin,
Arc<Mutex<HashMap<u64, Arc<TaskEntry>>>>: Unpin,
Arc<PipeInner>: Unpin,
&'static [&'static str]: Unpin,
&'static str: Unpin,
&'static [ParamOption]: Unpin,
&'static [Example]: Unpin,
Box<GuardExpr>: Unpin,
Box<Expr>: Unpin,
Box<StepKind>: Unpin,
Arc<dyn Fn(Vec<Value>) -> Result<Value, Diagnostic> + Send + Sync>: Unpin,
Arc<dyn Fn(&mut StepCtx<'_, P>, Vec<Value>) -> Result<Value, Diagnostic> + Send + Sync>: Unpin,
Arc<HashMap<String, HashMap<String, Arc<dyn Fn(Vec<Value>) -> Result<Value, Diagnostic> + Send + Sync>>>>: Unpin,
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> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
Source§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
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>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
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)
fn as_any(&self) -> &(dyn Any + 'static)
&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)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
&mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &mut Any’s vtable from &mut Trait’s.