pub struct ProcessingMode {
pub rules: HashMap<String, Vec<ConstructionRule>>,
pub default_rule: Option<Value>,
}Expand description
Processing mode containing construction rules
Corresponds to OpenJade’s ProcessingMode class.
Stores all element construction rules defined in the template.
Fields§
§rules: HashMap<String, Vec<ConstructionRule>>Construction rules indexed by element name for O(1) lookup HashMap<element_name, Vec<rules_for_that_element>> This avoids linear search through all rules for every element.
default_rule: Option<Value>Default construction rule (fallback when no specific rule matches)
Implementations§
Source§impl ProcessingMode
impl ProcessingMode
Sourcepub fn add_rule(
&mut self,
element_name: String,
context: Vec<String>,
expr: Value,
source_file: Option<String>,
source_pos: Option<Position>,
)
pub fn add_rule( &mut self, element_name: String, context: Vec<String>, expr: Value, source_file: Option<String>, source_pos: Option<Position>, )
Add a construction rule
Sourcepub fn add_default_rule(&mut self, expr: Value)
pub fn add_default_rule(&mut self, expr: Value)
Add a default construction rule
Sourcepub fn find_match(&self, gi: &str, node: &dyn Node) -> Option<&ConstructionRule>
pub fn find_match(&self, gi: &str, node: &dyn Node) -> Option<&ConstructionRule>
Find matching rule for an element
Corresponds to OpenJade’s ProcessingMode::findMatch().
Returns the first rule matching the given element name and context.
OPTIMIZATION: Uses HashMap lookup by element name (O(1)) instead of linear search through all rules (O(N)). Critical for large documents!
Auto Trait Implementations§
impl !Freeze for ProcessingMode
impl !RefUnwindSafe for ProcessingMode
impl !Send for ProcessingMode
impl !Sync for ProcessingMode
impl !UnwindSafe for ProcessingMode
impl Unpin for ProcessingMode
impl UnsafeUnpin for ProcessingMode
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
Mutably borrows from an owned value. Read more