Trait jomini::TokenResolver[][src]

pub trait TokenResolver {
    fn resolve(&self, token: u16) -> Option<&str>;
}
Expand description

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

Return the string field name of the 16bit token if found

Implementations on Foreign Types

Implementors