Struct fst::automaton::Str [−][src]
pub struct Str<'a> { /* fields omitted */ }
Expand description
An automaton that matches if the input equals to a specific string.
It can be used in combination with StartsWith
to search strings
starting with a given prefix.
extern crate fst; use fst::{Automaton, IntoStreamer, Streamer, Set}; use fst::automaton::Str; fn example() -> Result<(), Box<dyn std::error::Error>> { let paths = vec!["/home/projects/bar", "/home/projects/foo", "/tmp/foo"]; let set = Set::from_iter(paths)?; // Build our prefix query. let prefix = Str::new("/home").starts_with(); // Apply our query to the set we built. let mut stream = set.search(prefix).into_stream(); let matches = stream.into_strs()?; assert_eq!(matches, vec!["/home/projects/bar", "/home/projects/foo"]); Ok(()) }
Implementations
Trait Implementations
Returns true if and only if state
is a match state.
Returns true if and only if state
can lead to a match in zero or more
steps. Read more
Return the next state given state
and an input.
Returns true if and only if state
matches and must match no matter
what steps are taken. Read more
If applicable, return the next state when the end of a key is seen.
Returns an automaton that matches the strings that start with something this automaton matches. Read more
Returns an automaton that matches the strings matched by either this or the other automaton. Read more
Returns an automaton that matches the strings matched by both this and the other automaton. Read more
Returns an automaton that matches the strings not matched by this automaton. Read more
Auto Trait Implementations
impl<'a> RefUnwindSafe for Str<'a>
impl<'a> UnwindSafe for Str<'a>
Blanket Implementations
Mutably borrows from an owned value. Read more