Skip to main content

Tokens

Trait Tokens 

Source
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§

Source

fn longest(&self, token: &str) -> Option<usize>

The most cells {token} can become, or None if it isn’t one of the game’s tokens.

Provided Methods§

Source

fn unknown(&self, token: &str) -> String

What a {token} that is neither the game’s nor a name token is told.

Source

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.

Source

fn unknown_name(&self, id: &str, token: &str) -> String

What the name token {token} is told when id isn’t in the names table.

Source

fn written_name(&self, _id: &str, _form: &str) -> Option<String>

What a display name written out in a line (form, of name id) is told instead of the usual advice, if the game fills that name in some other way.

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§