[−][src]Struct fst::automaton::Str
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
impl<'a> Str<'a>
[src]
Trait Implementations
impl<'a> Automaton for Str<'a>
[src]
type State = Option<usize>
The type of the state used in the automaton.
fn start(&self) -> Option<usize>
[src]
fn is_match(&self, pos: &Option<usize>) -> bool
[src]
fn can_match(&self, pos: &Option<usize>) -> bool
[src]
fn accept(&self, pos: &Option<usize>, byte: u8) -> Option<usize>
[src]
fn will_always_match(&self, _state: &Self::State) -> bool
[src]
fn accept_eof(&self, _: &Self::State) -> Option<Self::State>
[src]
fn starts_with(self) -> StartsWith<Self> where
Self: Sized,
[src]
Self: Sized,
fn union<Rhs: Automaton>(self, rhs: Rhs) -> Union<Self, Rhs> where
Self: Sized,
[src]
Self: Sized,
fn intersection<Rhs: Automaton>(self, rhs: Rhs) -> Intersection<Self, Rhs> where
Self: Sized,
[src]
Self: Sized,
fn complement(self) -> Complement<Self> where
Self: Sized,
[src]
Self: Sized,
impl<'a> Clone for Str<'a>
[src]
impl<'a> Debug for Str<'a>
[src]
Auto Trait Implementations
impl<'a> RefUnwindSafe for Str<'a>
impl<'a> Send for Str<'a>
impl<'a> Sync for Str<'a>
impl<'a> Unpin for Str<'a>
impl<'a> UnwindSafe for Str<'a>
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T> ToOwned for T where
T: Clone,
[src]
T: Clone,
type Owned = T
The resulting type after obtaining ownership.
fn to_owned(&self) -> T
[src]
fn clone_into(&self, target: &mut T)
[src]
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,