pub struct RulesOption {
pub open: BTreeMap<String, RuleMod>,
pub close: BTreeMap<String, RuleMod>,
}Expand description
Which grammar rules a directive modifies.
open rules detect the directive’s open token and push to the
directive rule; close rules detect the close token (when there is
one) so it also ends sibling parsing.
Rules are held in a BTreeMap so a directive installs its grammar in
a deterministic order.
Fields§
§open: BTreeMap<String, RuleMod>§close: BTreeMap<String, RuleMod>Implementations§
Source§impl RulesOption
impl RulesOption
Sourcepub fn new() -> Self
pub fn new() -> Self
A rules option that modifies nothing. Passed to
DirectiveOptions::with_rules it suppresses the defaults
entirely — which leaves the open token unrecognised.
Sourcepub fn open_rules(self, rules: &str) -> Self
pub fn open_rules(self, rules: &str) -> Self
Set the open-side rules from a comma-separated list of rule names.
Sourcepub fn close_rules(self, rules: &str) -> Self
pub fn close_rules(self, rules: &str) -> Self
Set the close-side rules from a comma-separated list of rule names.
Sourcepub fn open_rule(self, name: impl Into<String>, modification: RuleMod) -> Self
pub fn open_rule(self, name: impl Into<String>, modification: RuleMod) -> Self
Add one open-side rule, optionally gated by a condition.
Sourcepub fn close_rule(self, name: impl Into<String>, modification: RuleMod) -> Self
pub fn close_rule(self, name: impl Into<String>, modification: RuleMod) -> Self
Add one close-side rule, optionally gated by a condition.
Trait Implementations§
Source§impl Clone for RulesOption
impl Clone for RulesOption
Source§impl Debug for RulesOption
impl Debug for RulesOption
Auto Trait Implementations§
impl !RefUnwindSafe for RulesOption
impl !UnwindSafe for RulesOption
impl Forget for RulesOption
impl Freeze for RulesOption
impl Move for RulesOption
impl Send for RulesOption
impl Sync for RulesOption
impl Unpin for RulesOption
impl UnsafeUnpin for RulesOptionwhere
*const LeafNode<String, RuleMod> is !null: UnsafeUnpin,
PhantomData<(Owned, LeafOrInternal)>: UnsafeUnpin,
PhantomData<Box<(String, RuleMod)>>: UnsafeUnpin,
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