pub struct RuleMap<Q, S>{ /* private fields */ }
Implementations§
Source§impl<Q, S> RuleMap<Q, S>
impl<Q, S> RuleMap<Q, S>
pub fn new() -> Self
pub fn from_state(initial_state: State<Q>) -> Self
pub fn from_iter<I>(iter: I) -> Self
pub fn from_rules<I>(iter: I) -> Selfwhere
I: IntoIterator<Item = Rule<Q, S>>,
Sourcepub fn with_initial_state(self, state: State<Q>) -> Self
pub fn with_initial_state(self, state: State<Q>) -> Self
configures the ruleset with the given initial state
pub fn with_instructions( self, instructions: impl IntoIterator<Item = (Head<Q, S>, Tail<Q, S>)>, ) -> Self
Sourcepub fn initial_state(&self) -> Option<State<&Q>>
pub fn initial_state(&self) -> Option<State<&Q>>
returns an instance of State which owns a reference to the interval value.
Sourcepub const fn rules(&self) -> &HashMap<Head<Q, S>, Tail<Q, S>>
pub const fn rules(&self) -> &HashMap<Head<Q, S>, Tail<Q, S>>
returns an immutable reference to the set of rules.
Sourcepub const fn rules_mut(&mut self) -> &mut HashMap<Head<Q, S>, Tail<Q, S>>
pub const fn rules_mut(&mut self) -> &mut HashMap<Head<Q, S>, Tail<Q, S>>
returns a mutable reference to the set of rules.
Sourcepub fn rule(&mut self, head: Head<Q, S>) -> Entry<'_, Head<Q, S>, Tail<Q, S>>
pub fn rule(&mut self, head: Head<Q, S>) -> Entry<'_, Head<Q, S>, Tail<Q, S>>
returns an the entry for the given head within the set of rules.
Sourcepub fn get_head<K>(&self, head: &K) -> Option<&Tail<Q, S>>
pub fn get_head<K>(&self, head: &K) -> Option<&Tail<Q, S>>
returns an immutable reference to the tail of the rule for the given head; returns none if the head is not found.
Sourcepub fn get_mut<K>(&mut self, head: &K) -> Option<&mut Tail<Q, S>>
pub fn get_mut<K>(&mut self, head: &K) -> Option<&mut Tail<Q, S>>
returns a mutable reference to the tail of the rule for the given head; returns none if the head is not found.
Sourcepub fn get_ref<K>(&self, head: &K) -> Option<Tail<&Q, &S>>
pub fn get_ref<K>(&self, head: &K) -> Option<Tail<&Q, &S>>
returns the tail of the rule for the given head; returns none if the head is not found within the set of rules.
Sourcepub fn insert(&mut self, head: Head<Q, S>, tail: Tail<Q, S>)
pub fn insert(&mut self, head: Head<Q, S>, tail: Tail<Q, S>)
insert a new rule into the set of rules.
Sourcepub fn insert_rule(&mut self, rule: Rule<Q, S>)
pub fn insert_rule(&mut self, rule: Rule<Q, S>)
insert a new rule into the set of rules.
Sourcepub fn or_insert(
&mut self,
head: Head<Q, S>,
tail: Tail<Q, S>,
) -> &mut Tail<Q, S>
pub fn or_insert( &mut self, head: Head<Q, S>, tail: Tail<Q, S>, ) -> &mut Tail<Q, S>
returns a mutable reference to the tail of the rule for the given head; inserts the tail if the head is not found.
Sourcepub fn or_insert_with<F>(&mut self, head: Head<Q, S>, f: F) -> &mut Tail<Q, S>
pub fn or_insert_with<F>(&mut self, head: Head<Q, S>, f: F) -> &mut Tail<Q, S>
returns a mutable reference to the tail of the rule for the given head; inserts the tail if the head is not found.
Sourcepub fn or_insert_default(&mut self, head: Head<Q, S>) -> &mut Tail<Q, S>
pub fn or_insert_default(&mut self, head: Head<Q, S>) -> &mut Tail<Q, S>
returns a mutable reference to the tail of the rule for the given head; inserts the default tail if the head is not found.
Trait Implementations§
Source§impl<Q, S> Extend<(Head<Q, S>, Tail<Q, S>)> for RuleMap<Q, S>
impl<Q, S> Extend<(Head<Q, S>, Tail<Q, S>)> for RuleMap<Q, S>
Source§fn extend<I>(&mut self, iter: I)
fn extend<I>(&mut self, iter: I)
Source§fn extend_one(&mut self, item: A)
fn extend_one(&mut self, item: A)
extend_one
)Source§fn extend_reserve(&mut self, additional: usize)
fn extend_reserve(&mut self, additional: usize)
extend_one
)Source§impl<Q, S> Extend<Rule<Q, S>> for RuleMap<Q, S>
impl<Q, S> Extend<Rule<Q, S>> for RuleMap<Q, S>
Source§fn extend<I>(&mut self, iter: I)where
I: IntoIterator<Item = Rule<Q, S>>,
fn extend<I>(&mut self, iter: I)where
I: IntoIterator<Item = Rule<Q, S>>,
Source§fn extend_one(&mut self, item: A)
fn extend_one(&mut self, item: A)
extend_one
)Source§fn extend_reserve(&mut self, additional: usize)
fn extend_reserve(&mut self, additional: usize)
extend_one
)