[−][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 std::error::Error; use fst::{Automaton, IntoStreamer, Streamer, Set}; use fst::automaton::Str; fn example() -> Result<(), Box<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(()) }
Methods
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]
Returns true if and only if state
matches and must match no matter what steps are taken. Read more
fn starts_with(self) -> StartsWith<Self> where
Self: Sized,
[src]
Self: Sized,
Returns an automaton that matches the strings that start with something this automaton matches. Read more
fn union<Rhs: Automaton>(self, rhs: Rhs) -> Union<Self, Rhs> where
Self: Sized,
[src]
Self: Sized,
Returns an automaton that matches the strings matched by either this or the other automaton. Read more
fn intersection<Rhs: Automaton>(self, rhs: Rhs) -> Intersection<Self, Rhs> where
Self: Sized,
[src]
Self: Sized,
Returns an automaton that matches the strings matched by both this and the other automaton. Read more
fn complement(self) -> Complement<Self> where
Self: Sized,
[src]
Self: Sized,
Returns an automaton that matches the strings not matched by this automaton. Read more
impl<'a> Clone for Str<'a>
[src]
fn clone(&self) -> Str<'a>
[src]
fn clone_from(&mut self, source: &Self)
1.0.0[src]
Performs copy-assignment from source
. Read more
impl<'a> Debug for Str<'a>
[src]
Auto Trait Implementations
impl<'a> Unpin for Str<'a>
impl<'a> Sync for Str<'a>
impl<'a> Send for Str<'a>
impl<'a> RefUnwindSafe for Str<'a>
impl<'a> UnwindSafe for Str<'a>
Blanket Implementations
impl<T> From<T> for T
[src]
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> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
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>,
type Error = <U as TryFrom<T>>::Error
The type returned in the event of a conversion error.
fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>
[src]
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> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,