[−][src]Trait jomini::TokenResolver
Resolves binary 16bit tokens to field names
One can create their own TokenResolver
or rely on the HashMap implementation
use std::collections::HashMap; use jomini::TokenResolver; let mut map = HashMap::new(); map.insert(0x2d82, String::from("field1")); assert_eq!(map.resolve(0x2d82), Some("field1"));
The HashMap implementation works with string slices as well
use std::collections::HashMap; use jomini::TokenResolver; let mut map = HashMap::new(); map.insert(0x2d82, "field1"); assert_eq!(map.resolve(0x0000), None);
Required methods
fn resolve(&self, token: u16) -> Option<&str>
Return the string field name of the 16bit token if found
Implementations on Foreign Types
impl<S, V> TokenResolver for HashMap<u16, V, S> where
S: BuildHasher,
V: AsRef<str>,
[src]
S: BuildHasher,
V: AsRef<str>,