pub struct ExecutionContext<'a> {
pub source: Cow<'a, str>,
pub map: PipelineHashMap<SmolStr, SmolStr>,
pub schemas: PipelineHashMap<SmolStr, SchemaInfo>,
pub types: PipelineHashMap<SmolStr, TypeInfo>,
pub commands: PipelineHashMap<Cow<'a, str>, CommandInfo<'a>>,
pub key_line_map: PipelineHashMap<SmolStr, usize>,
pub scope_stack: Vec<Cow<'a, str>>,
pub visited_keys: HashSet<SmolStr>,
pub imported_files: HashSet<Cow<'a, str>>,
}Expand description
Encapsulates all runtime context needed during execution.
This struct holds the accumulated state that would normally be scattered across the AAML struct and various registries.
Fields§
§source: Cow<'a, str>Source file path or identifier (for error reporting)
map: PipelineHashMap<SmolStr, SmolStr>Key-value map accumulated during parsing (using SmolStr for SSO)
schemas: PipelineHashMap<SmolStr, SchemaInfo>Schema definitions accumulated from @schema directives
types: PipelineHashMap<SmolStr, TypeInfo>Type definitions accumulated from @type directives
commands: PipelineHashMap<Cow<'a, str>, CommandInfo<'a>>Registered commands (directives)
key_line_map: PipelineHashMap<SmolStr, usize>Line number map: key → line number where it was defined
scope_stack: Vec<Cow<'a, str>>Scope tracking for nested configurations
visited_keys: HashSet<SmolStr>Circular reference detection set
imported_files: HashSet<Cow<'a, str>>Import cache to prevent re-importing the same file
Implementations§
Source§impl<'a> ExecutionContext<'a>
impl<'a> ExecutionContext<'a>
Sourcepub fn default_value_for_type(&self, type_name: &str) -> Option<&str>
pub fn default_value_for_type(&self, type_name: &str) -> Option<&str>
Returns the registered inheritance default for a given type.
Sourcepub fn current_scope(&self) -> String
pub fn current_scope(&self) -> String
Returns the current scope as a string path.
Sourcepub fn push_scope(&mut self, scope_name: impl Into<Cow<'a, str>>)
pub fn push_scope(&mut self, scope_name: impl Into<Cow<'a, str>>)
Enters a new nested scope.
Sourcepub fn set_value(
&mut self,
key: impl AsRef<str>,
value: impl AsRef<str>,
line: usize,
)
pub fn set_value( &mut self, key: impl AsRef<str>, value: impl AsRef<str>, line: usize, )
Sets a key-value pair in the map with line tracking.
Sourcepub fn register_schema(&mut self, schema: SchemaInfo)
pub fn register_schema(&mut self, schema: SchemaInfo)
Registers a schema definition.
Sourcepub fn register_type(&mut self, type_def: TypeInfo) -> Result<(), AamlError>
pub fn register_type(&mut self, type_def: TypeInfo) -> Result<(), AamlError>
Registers a type definition.
§Errors
Returns AamlError::CircularDependency if registering this type would
create a recursive alias cycle (e.g. A = B, B = C, C = A).
Sourcepub fn register_command(&mut self, command: CommandInfo<'a>)
pub fn register_command(&mut self, command: CommandInfo<'a>)
Registers a command (directive).
Sourcepub fn mark_visited(&mut self, key: &str)
pub fn mark_visited(&mut self, key: &str)
Checks if a key has been visited (for cycle detection).
Sourcepub fn is_visited(&self, key: &str) -> bool
pub fn is_visited(&self, key: &str) -> bool
Checks if a key has been visited.
Sourcepub fn reset_visited(&mut self)
pub fn reset_visited(&mut self)
Clears visited set for a new traversal.
Sourcepub fn record_import(&mut self, file_path: impl Into<Cow<'a, str>>)
pub fn record_import(&mut self, file_path: impl Into<Cow<'a, str>>)
Records an imported file.
Sourcepub fn is_imported(&self, file_path: &str) -> bool
pub fn is_imported(&self, file_path: &str) -> bool
Checks if a file has already been imported.
Sourcepub fn get_line_for_key(&self, key: &str) -> Option<usize>
pub fn get_line_for_key(&self, key: &str) -> Option<usize>
Returns the line number where a key was defined.
Trait Implementations§
Auto Trait Implementations§
impl<'a> Freeze for ExecutionContext<'a>
impl<'a> RefUnwindSafe for ExecutionContext<'a>
impl<'a> Send for ExecutionContext<'a>
impl<'a> Sync for ExecutionContext<'a>
impl<'a> Unpin for ExecutionContext<'a>
impl<'a> UnsafeUnpin for ExecutionContext<'a>
impl<'a> UnwindSafe for ExecutionContext<'a>
Blanket Implementations§
Source§impl<T> ArchivePointee for T
impl<T> ArchivePointee for T
Source§type ArchivedMetadata = ()
type ArchivedMetadata = ()
Source§fn pointer_metadata(
_: &<T as ArchivePointee>::ArchivedMetadata,
) -> <T as Pointee>::Metadata
fn pointer_metadata( _: &<T as ArchivePointee>::ArchivedMetadata, ) -> <T as Pointee>::Metadata
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> LayoutRaw for T
impl<T> LayoutRaw for T
Source§fn layout_raw(_: <T as Pointee>::Metadata) -> Result<Layout, LayoutError>
fn layout_raw(_: <T as Pointee>::Metadata) -> Result<Layout, LayoutError>
Source§impl<T, N1, N2> Niching<NichedOption<T, N1>> for N2
impl<T, N1, N2> Niching<NichedOption<T, N1>> for N2
Source§unsafe fn is_niched(niched: *const NichedOption<T, N1>) -> bool
unsafe fn is_niched(niched: *const NichedOption<T, N1>) -> bool
Source§fn resolve_niched(out: Place<NichedOption<T, N1>>)
fn resolve_niched(out: Place<NichedOption<T, N1>>)
out indicating that a T is niched.