pub trait Tokens {
// Required method
fn longest(&self, token: &str) -> Option<usize>;
// Provided methods
fn unknown(&self, token: &str) -> String { ... }
fn reserved_name(&self, _id: &str, _token: &str) -> Option<String> { ... }
fn unknown_name(&self, id: &str, token: &str) -> String { ... }
fn written_name(&self, _id: &str, _form: &str) -> Option<String> { ... }
}Expand description
The {tokens} a game fills in itself, besides the names table’s
({n:<id>}, Names): a player-named hero’s name, say.
Required Methods§
Provided Methods§
Sourcefn unknown(&self, token: &str) -> String
fn unknown(&self, token: &str) -> String
What a {token} that is neither the game’s nor a name token is
told.
Sourcefn reserved_name(&self, _id: &str, _token: &str) -> Option<String>
fn reserved_name(&self, _id: &str, _token: &str) -> Option<String>
What the name token {token} (naming id) is told before the
table is asked: a name the game fills in some other way. None
for most ids.
Sourcefn unknown_name(&self, id: &str, token: &str) -> String
fn unknown_name(&self, id: &str, token: &str) -> String
What the name token {token} is told when id isn’t in the names
table.
Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".