pub struct RewriteEngine { /* private fields */ }Expand description
A collection of rewrite rules with application tracking.
Implementations§
Source§impl RewriteEngine
impl RewriteEngine
Sourcepub fn set_max_passes(&mut self, max: u32)
pub fn set_max_passes(&mut self, max: u32)
Set the maximum number of rewrite passes.
Sourcepub fn max_passes(&self) -> u32
pub fn max_passes(&self) -> u32
Get the maximum number of rewrite passes.
Sourcepub fn add_rule(&mut self, rule: RewriteRule)
pub fn add_rule(&mut self, rule: RewriteRule)
Add a rewrite rule.
Sourcepub fn rule_count(&self) -> usize
pub fn rule_count(&self) -> usize
Get the number of registered rules.
Sourcepub fn get_rule(&self, id: RuleId) -> Option<&RewriteRule>
pub fn get_rule(&self, id: RuleId) -> Option<&RewriteRule>
Get a rule by its ID.
Sourcepub fn get_rule_mut(&mut self, id: RuleId) -> Option<&mut RewriteRule>
pub fn get_rule_mut(&mut self, id: RuleId) -> Option<&mut RewriteRule>
Get a mutable reference to a rule by its ID.
Sourcepub fn find_matches(
&self,
filter_type: &str,
properties: &HashMap<String, String>,
) -> Vec<&RewriteRule>
pub fn find_matches( &self, filter_type: &str, properties: &HashMap<String, String>, ) -> Vec<&RewriteRule>
Find matching rules for a single node.
Sourcepub fn find_chain_matches(
&self,
first_type: &str,
second_type: &str,
) -> Vec<&RewriteRule>
pub fn find_chain_matches( &self, first_type: &str, second_type: &str, ) -> Vec<&RewriteRule>
Find matching rules for a chain of two nodes.
Sourcepub fn record_event(&mut self, rule: &RewriteRule, matched: &str)
pub fn record_event(&mut self, rule: &RewriteRule, matched: &str)
Record a rewrite event.
Sourcepub fn history(&self) -> &[RewriteEvent]
pub fn history(&self) -> &[RewriteEvent]
Get the history of applied rewrites.
Sourcepub fn clear_history(&mut self)
pub fn clear_history(&mut self)
Clear the rewrite history.
Sourcepub fn remove_rule(&mut self, id: RuleId) -> bool
pub fn remove_rule(&mut self, id: RuleId) -> bool
Remove a rule by its ID.
Sourcepub fn enable_all(&mut self)
pub fn enable_all(&mut self)
Enable all rules.
Sourcepub fn disable_all(&mut self)
pub fn disable_all(&mut self)
Disable all rules.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for RewriteEngine
impl RefUnwindSafe for RewriteEngine
impl Send for RewriteEngine
impl Sync for RewriteEngine
impl Unpin for RewriteEngine
impl UnsafeUnpin for RewriteEngine
impl UnwindSafe for RewriteEngine
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
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more