pub trait PrefixMap<V> {
// Required method
fn get_longest_prefix<P: AsRef<str>>(&self, inp: P) -> Option<(usize, &V)>;
}Expand description
A PrefixMap is a map that supports operations on the prefix of an input
Required Methods§
Sourcefn get_longest_prefix<P: AsRef<str>>(&self, inp: P) -> Option<(usize, &V)>
fn get_longest_prefix<P: AsRef<str>>(&self, inp: P) -> Option<(usize, &V)>
Get the corresponding length and value of the key that is part of the lonest prefix of inp
§Example
use asciimath_parser::prefix_map::{HashPrefixMap, PrefixMap};
let map = HashPrefixMap::from_iter([("a", 1), ("abc", 3)]);
assert_eq!(map.get_longest_prefix("ab"), Some((1, &1)));Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.