Skip to main content

PassageImpl

Trait PassageImpl 

Source
pub trait PassageImpl: 'static
where Self::State: Serialize + for<'a> Deserialize<'a>,
{ type State; // Required methods fn run(&self, h: PassageHandle, state: Self::State) -> PassageResult; fn name(&self) -> &'static str; fn module_path(&self) -> &'static str; // Provided methods fn with_state(&self, state: Self::State) -> Passage { ... } fn registry_key(&self) -> String { ... } }

Required Associated Types§

Required Methods§

Source

fn run(&self, h: PassageHandle, state: Self::State) -> PassageResult

Source

fn name(&self) -> &'static str

Source

fn module_path(&self) -> &'static str

Provided Methods§

Source

fn with_state(&self, state: Self::State) -> Passage

Examples found in repository?
examples/hello_world.rs (line 11)
10pub fn main() {
11    CliRunner::run(HelloWorld.with_state(()));
12}
More examples
Hide additional examples
examples/small_dungeon.rs (lines 43-46)
42pub fn main() {
43    CliRunner::run(MainHall.with_state(State {
44        gold: 0,
45        left_gold: 5,
46    }));
47}
Source

fn registry_key(&self) -> String

Dyn Compatibility§

This trait is dyn compatible.

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

Implementors§