Struct fst::automaton::Subsequence[][src]

pub struct Subsequence<'a> { /* fields omitted */ }
Expand description

An automaton that matches if the input contains a specific subsequence.

It can be used to build a simple fuzzy-finder.

extern crate fst;

use fst::{IntoStreamer, Streamer, Set};
use fst::automaton::Subsequence;

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 fuzzy query.
    let subseq = Subsequence::new("hpf");

    // Apply our fuzzy query to the set we built.
    let mut stream = set.search(subseq).into_stream();

    let matches = stream.into_strs()?;
    assert_eq!(matches, vec!["/home/projects/foo"]);
    Ok(())
}

Implementations

Constructs automaton that matches input containing the specified subsequence.

Trait Implementations

The type of the state used in the automaton.

Returns a single start state for this automaton. Read more

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

Returns true if and only if state matches and must match no matter what steps are taken. Read more

Return the next state given state and an input.

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

Returns a copy of the value. Read more

Performs copy-assignment from source. Read more

Formats the value using the given formatter. Read more

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

Immutably borrows from an owned value. Read more

Mutably borrows from an owned value. Read more

Performs the conversion.

Performs the conversion.

The resulting type after obtaining ownership.

Creates owned data from borrowed data, usually by cloning. Read more

🔬 This is a nightly-only experimental API. (toowned_clone_into)

recently added

Uses borrowed data to replace owned data, usually by cloning. Read more

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.