pub struct ExecState<P>where
P: ProcessManager,{ /* 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.
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> + Sync + Send>>>> ⓘ
pub fn pure_function_table( &self, ) -> Arc<HashMap<String, HashMap<String, Arc<dyn Fn(Vec<Value>) -> Result<Value, Diagnostic> + Sync + Send>>>> ⓘ
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 register_type(&mut self, descriptor: &'static TypeDescriptor)
pub fn register_type(&mut self, descriptor: &'static TypeDescriptor)
Register a host-defined type descriptor (usually T::descriptor()
for a #[oxdock_type] payload). Makes the name visible to TYPES()
and valid for LET $x: NAME declarations carrying same-named
payloads. Re-registering a name returns silently when the descriptor
is identical; a different descriptor under a live name panics
instead of aliasing two layouts.
Sourcepub fn is_known_type(&self, name: &str) -> bool
pub fn is_known_type(&self, name: &str) -> bool
True when name names a registered type (startup or host).
Sourcepub fn register_record_schema(
&mut self,
name: &'static str,
fields: Arc<[Field]>,
)
pub fn register_record_schema( &mut self, name: &'static str, fields: Arc<[Field]>, )
Register a named record schema for shaped MAP bindings (usually
alongside the module that produces them). Makes the name valid
for LET $x: NAME declarations carrying conforming maps. A
different field table under a live name panics instead of
aliasing two shapes.
Sourcepub fn schema_names(&self) -> Vec<String>
pub fn schema_names(&self) -> Vec<String>
Every registered schema name, sorted. Backs discovery listings.
Sourcepub fn alias_names(&self) -> Vec<String>
pub fn alias_names(&self) -> Vec<String>
Every script alias name, sorted. Backs discovery listings and unknown-type errors alongside schemas.
Sourcepub fn alias_target(&self, name: &str) -> Option<String>
pub fn alias_target(&self, name: &str) -> Option<String>
The canonical target spelling of one script alias, if defined.
Backs TYPE_DESCRIBE so aliases introspect like named types.
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 to its tag: builtins by closed
match, customs through the type directory, named schemas through
the schema directory, script aliases through the alias directory,
generic spellings (LIST<MAP>, MAP<name: STRING>) rendered
structurally, and unions (STRING|PIPE, including inside
generics) with one interned entry per distinct spelling.
Anything else bails listing every known type, schema, and alias.
Single choke for every LET/FUNC declaration. Signature is
stable: alias cycles and shared depth accounting thread
internally, so all call sites gain generics with zero edits.
Source§impl<P> ExecState<P>where
P: ProcessManager,
impl<P> ExecState<P>where
P: ProcessManager,
Sourcepub fn check_declaration_tag(
&self,
what: &str,
tag: &TypeTag,
) -> Result<(), Diagnostic>
pub fn check_declaration_tag( &self, what: &str, tag: &TypeTag, ) -> Result<(), Diagnostic>
Declaration-site gate for everything that is not a function return: LET bindings, parameters, schemas, aliases at use. Single choke so the VOID position rule cannot drift between the static checker and runtime definition paths.
Sourcepub fn check_return_tag(
&self,
what: &str,
tag: &TypeTag,
) -> Result<(), Diagnostic>
pub fn check_return_tag( &self, what: &str, tag: &TypeTag, ) -> Result<(), Diagnostic>
Return-position gate: bare VOID is legal here (and only here, besides HANDLE payloads). Same single recursion as every other declaration site.
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.
Sourcepub fn describe_type(&self, name: &str) -> Option<&'static TypeDescriptor>
pub fn describe_type(&self, name: &str) -> Option<&'static TypeDescriptor>
Resolve a descriptor by name, or None when unregistered.
Sourcepub fn type_names(&self) -> Vec<String>
pub fn type_names(&self) -> Vec<String>
Every registered type name: startup descriptors first, then hosts in registration order, then script aliases.
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, &'static TypeDescriptor)>: Freeze,
PhantomData<(String, Arc<[Field]>)>: Freeze,
PhantomData<((String, TypeId), Arc<dyn Any + Sync + Send>)>: 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> + Sync + Send>>>> is !null: Freeze,
PhantomData<ArcInner<HashMap<String, HashMap<String, Arc<dyn Fn(Vec<Value>) -> Result<Value, Diagnostic> + Sync + Send>>>>>: Freeze,
PhantomData<(String, (String, String))>: Freeze,
PhantomData<GuardedPath>: Freeze,
PhantomData<(String, ModuleRecord)>: Freeze,
PhantomData<Option<String>>: Freeze,
PhantomData<(String, HashMap<String, Vec<(Option<String>, Option<GuardExpr>)>>)>: 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, &'static TypeDescriptor)>: Send,
RawTable<(String, Arc<[Field]>)>: Send,
RawTable<((String, TypeId), Arc<dyn Any + Sync + Send>)>: 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> + Sync + Send>: Send,
Arc<dyn Fn(&mut StepCtx<'_, P>, Vec<Value>) -> Result<Value, Diagnostic> + Sync + Send>: Send,
Arc<HashMap<String, HashMap<String, Arc<dyn Fn(Vec<Value>) -> Result<Value, Diagnostic> + Sync + Send>>>>: Send,
RawTable<(String, (String, String))>: Send,
RawTable<(String, ModuleRecord)>: Send,
RawTable<(String, HashMap<String, Vec<(Option<String>, Option<GuardExpr>)>>)>: Send,
RawTable<(String, Vec<(Option<String>, Option<GuardExpr>)>)>: 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 + Sync + Send>: 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> + Sync + Send>: Unpin,
Arc<dyn Fn(&mut StepCtx<'_, P>, Vec<Value>) -> Result<Value, Diagnostic> + Sync + Send>: Unpin,
Arc<HashMap<String, HashMap<String, Arc<dyn Fn(Vec<Value>) -> Result<Value, Diagnostic> + Sync + Send>>>>: 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, &'static TypeDescriptor)>: UnsafeUnpin,
PhantomData<(String, Arc<[Field]>)>: UnsafeUnpin,
PhantomData<((String, TypeId), Arc<dyn Any + Sync + Send>)>: 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> + Sync + Send>>>> is !null: UnsafeUnpin,
PhantomData<ArcInner<HashMap<String, HashMap<String, Arc<dyn Fn(Vec<Value>) -> Result<Value, Diagnostic> + Sync + Send>>>>>: UnsafeUnpin,
PhantomData<(String, (String, String))>: UnsafeUnpin,
PhantomData<GuardedPath>: UnsafeUnpin,
PhantomData<(String, ModuleRecord)>: UnsafeUnpin,
PhantomData<Option<String>>: UnsafeUnpin,
PhantomData<(String, HashMap<String, Vec<(Option<String>, Option<GuardExpr>)>>)>: 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.