pub struct NodeSet { /* private fields */ }Expand description
A set of syntax parse rules of fixed size.
The set stores all entries in place, and the set object has a fixed size.
The maximum number of rules the object could store is NodeSet::LIMIT.
Most methods of this object are the const functions. Some of them take up to
O(LIMIT) and O(LIMIT^2) time to perform.
The object is assumed to be constructed in a const context as a static value upfront to reduce the runtime overhead.
Implementations§
Source§impl NodeSet
impl NodeSet
Sourcepub const LIMIT: usize = 16usize
pub const LIMIT: usize = 16usize
The maximum number of entries this set can address.
This number may be increased in future minor versions of Lady Deirdre.
Sourcepub const fn empty() -> Self
pub const fn empty() -> Self
Creates a node set without entries.
If you need just a static empty node set, use the predefined EMPTY_NODE_SET static.
Sourcepub const fn contains(&self, rule: NodeRule) -> bool
pub const fn contains(&self, rule: NodeRule) -> bool
Returns true if the node set contains the specified node rule.
Sourcepub const fn include_all(self, rules: &[NodeRule]) -> Self
pub const fn include_all(self, rules: &[NodeRule]) -> Self
Sourcepub const fn exclude(self, rule: NodeRule) -> Self
pub const fn exclude(self, rule: NodeRule) -> Self
Consumes this NodeSet instance and returns a new node set without
the specified rule node rule.
Sourcepub const fn exclude_all(self, rules: &[NodeRule]) -> Self
pub const fn exclude_all(self, rules: &[NodeRule]) -> Self
Consumes this NodeSet instance and returns a new node set without
the entries specified in the rules node rule slice.