Skip to main content

ExecutionContext

Struct ExecutionContext 

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

Source

pub fn new(source: impl Into<Cow<'a, str>>) -> Self

Creates a new empty execution context.

Source

pub fn default_value_for_type(&self, type_name: &str) -> Option<&str>

Returns the registered inheritance default for a given type.

Source

pub fn current_scope(&self) -> String

Returns the current scope as a string path.

Source

pub fn push_scope(&mut self, scope_name: impl Into<Cow<'a, str>>)

Enters a new nested scope.

Source

pub fn pop_scope(&mut self)

Exits the current scope.

Source

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.

Source

pub fn get_value(&self, key: &str) -> Option<&str>

Gets a value from the map.

Source

pub fn register_schema(&mut self, schema: SchemaInfo)

Registers a schema definition.

Source

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).

Source

pub fn register_command(&mut self, command: CommandInfo<'a>)

Registers a command (directive).

Source

pub fn mark_visited(&mut self, key: &str)

Checks if a key has been visited (for cycle detection).

Source

pub fn is_visited(&self, key: &str) -> bool

Checks if a key has been visited.

Source

pub fn reset_visited(&mut self)

Clears visited set for a new traversal.

Source

pub fn record_import(&mut self, file_path: impl Into<Cow<'a, str>>)

Records an imported file.

Source

pub fn is_imported(&self, file_path: &str) -> bool

Checks if a file has already been imported.

Source

pub fn get_line_for_key(&self, key: &str) -> Option<usize>

Returns the line number where a key was defined.

Trait Implementations§

Source§

impl<'a> Debug for ExecutionContext<'a>

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more

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> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> ArchivePointee for T

Source§

type ArchivedMetadata = ()

The archived version of the pointer metadata for this type.
Source§

fn pointer_metadata( _: &<T as ArchivePointee>::ArchivedMetadata, ) -> <T as Pointee>::Metadata

Converts some archived metadata to the pointer metadata for itself.
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> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

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> LayoutRaw for T

Source§

fn layout_raw(_: <T as Pointee>::Metadata) -> Result<Layout, LayoutError>

Returns the layout of the type.
Source§

impl<T, N1, N2> Niching<NichedOption<T, N1>> for N2
where T: SharedNiching<N1, N2>, N1: Niching<T>, N2: Niching<T>,

Source§

unsafe fn is_niched(niched: *const NichedOption<T, N1>) -> bool

Returns whether the given value has been niched. Read more
Source§

fn resolve_niched(out: Place<NichedOption<T, N1>>)

Writes data to out indicating that a T is niched.
Source§

impl<T> Pointee for T

Source§

type Metadata = ()

The metadata type for pointers and references to this type.
Source§

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

Source§

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