pub struct Table {
pub source: &'static str,
pub nodes: &'static [Node],
pub rules: &'static [Rule],
}Expand description
A set of rules, as an automaton over their patterns.
Fields§
§source: &'static strThe rule file this was built from, so that anything said about a rule can name a file somebody can open.
nodes: &'static [Node]The trie. Node zero is the root.
rules: &'static [Rule]The rules, in the order the file writes them.
Implementations§
Source§impl Table
impl Table
Sourcepub fn find<S: Subject>(
&self,
subject: &S,
term: S::Node,
) -> Option<Match<S::Node>>
pub fn find<S: Subject>( &self, subject: &S, term: S::Node, ) -> Option<Match<S::Node>>
The rule that fires on this term, and what it bound.
The term is matched as a whole. Finding the terms in a function worth matching is the caller’s job and not this one’s.
Sourcepub fn find_in<S: Subject>(
&self,
subject: &S,
term: S::Node,
left: &mut Vec<S::Node>,
bindings: &mut Vec<S::Node>,
) -> Option<usize>
pub fn find_in<S: Subject>( &self, subject: &S, term: S::Node, left: &mut Vec<S::Node>, bindings: &mut Vec<S::Node>, ) -> Option<usize>
Table::find with the two stacks the walk needs handed in, for a caller that asks more
than once and would rather not pay for them every time.
Both are emptied before the walk. What bindings holds afterwards is what the pattern
bound when a rule fired, and nothing anybody reads when none did.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for Table
impl RefUnwindSafe for Table
impl Send for Table
impl Sync for Table
impl Unpin for Table
impl UnsafeUnpin for Table
impl UnwindSafe for Table
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