pub struct RewriteRule {
pub id: RuleId,
pub name: String,
pub pattern: PatternKind,
pub action: RewriteAction,
pub priority: i32,
pub enabled: bool,
}Expand description
A single graph rewrite rule.
Fields§
§id: RuleIdUnique identifier.
name: StringHuman-readable name for this rule.
pattern: PatternKindThe pattern to match.
action: RewriteActionThe action to take on match.
priority: i32Priority (higher = applied first).
enabled: boolWhether this rule is currently enabled.
Implementations§
Source§impl RewriteRule
impl RewriteRule
Sourcepub fn new(
id: RuleId,
name: &str,
pattern: PatternKind,
action: RewriteAction,
) -> Self
pub fn new( id: RuleId, name: &str, pattern: PatternKind, action: RewriteAction, ) -> Self
Create a new rewrite rule.
Sourcepub fn with_priority(self, priority: i32) -> Self
pub fn with_priority(self, priority: i32) -> Self
Set the priority of this rule.
Sourcepub fn set_enabled(&mut self, enabled: bool)
pub fn set_enabled(&mut self, enabled: bool)
Enable or disable this rule.
Sourcepub fn matches_node(
&self,
filter_type: &str,
properties: &HashMap<String, String>,
) -> bool
pub fn matches_node( &self, filter_type: &str, properties: &HashMap<String, String>, ) -> bool
Check whether this rule matches a given node description.
Sourcepub fn matches_chain(&self, first_type: &str, second_type: &str) -> bool
pub fn matches_chain(&self, first_type: &str, second_type: &str) -> bool
Check whether this rule matches a chain of two nodes.
Trait Implementations§
Source§impl Clone for RewriteRule
impl Clone for RewriteRule
Source§fn clone(&self) -> RewriteRule
fn clone(&self) -> RewriteRule
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for RewriteRule
impl Debug for RewriteRule
Auto Trait Implementations§
impl Freeze for RewriteRule
impl RefUnwindSafe for RewriteRule
impl Send for RewriteRule
impl Sync for RewriteRule
impl Unpin for RewriteRule
impl UnsafeUnpin for RewriteRule
impl UnwindSafe for RewriteRule
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> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
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