pub trait Matcher<W: Semiring, F: Fst<W>, B: Borrow<F>>: Debug {
type Iter: Iterator<Item = IterItemMatcher<W>>;
// Required methods
fn new(fst: B, match_type: MatchType) -> Result<Self>
where Self: Sized;
fn iter(&self, state: StateId, label: Label) -> Result<Self::Iter>;
fn final_weight(&self, state: StateId) -> Result<Option<W>>;
fn match_type(&self, test: bool) -> Result<MatchType>;
fn flags(&self) -> MatcherFlags;
fn priority(&self, state: StateId) -> Result<usize>;
fn fst(&self) -> &B;
}
Expand description
Matchers find and iterate through requested labels at FST states. In the simplest form, these are just some associative map or search keyed on labels. More generally, they may implement matching special labels that represent sets of labels such as sigma (all), rho (rest), or phi (fail).
Required Associated Types§
type Iter: Iterator<Item = IterItemMatcher<W>>
Required Methods§
fn new(fst: B, match_type: MatchType) -> Result<Self>where
Self: Sized,
fn iter(&self, state: StateId, label: Label) -> Result<Self::Iter>
fn final_weight(&self, state: StateId) -> Result<Option<W>>
fn match_type(&self, test: bool) -> Result<MatchType>
fn flags(&self) -> MatcherFlags
sourcefn priority(&self, state: StateId) -> Result<usize>
fn priority(&self, state: StateId) -> Result<usize>
Indicates preference for being the side used for matching in composition. If the value is kRequirePriority, then it is mandatory that it be used. Calling this method without passing the current state of the matcher invalidates the state of the matcher.