Skip to main content

from_literals

Function from_literals 

Source
pub fn from_literals(
    literals: impl IntoIterator<Item = impl AsRef<str>>,
) -> Result<PatternSet, MatchError>
Expand description

Convenience: compile a set of literal strings for matching.

Each literal gets an ID equal to its index in the slice.

Example:

use multimatch::{from_literals};

let set = from_literals(&["password", "secret"]).unwrap();
assert_eq!(set.scan(b"secret").len(), 1);