Crate solstack

source ·
Expand description

Solstack is a library that enables you to manage the control flow of your application through what’s known as a state stack machine.

This library provides a Stack type that holds a stack of States. When the stack is ticked (a tick being an update/frame call) it executes the methods on the topmost state it holds. This means that only one state is run at a time; the one at the top.

You can read The Book. Or you can take a look at the examples on the git repository. And you may search documentation at the crate’s docs.

Project is in early development, things may change around! The documentation will always be updated.

By Sol

Modules

Macros

Alternative to stack.pop(&mut data). Use stack_pop(stack, data) Or stack_pop(stack, data, 3) 3 being the amount of states to pop. OBS.: Don’t use &mut data as a parameter, but simply data.
Alternative to stack.push(&mut data, Box::new(FooState {})). Use stack_push!(stack, data, FooState {}, BarState {}, ...) OBS.: Don’t use &mut data as a parameter, but simply data.
Alternative to stack.quit(&mut data). Use stack_quit!(stack, data). OBS.: Don’t use &mut data as a parameter, but simply data.
Alternative to stack.tick(&mut data). Use stack_tick(stack, data). OBS.: Don’t use &mut data as a parameter, but simply data.
Alternative to Trans::None. Use trans_none!()
Alternative to Trans::Pop. Use trans_pop!()
Alternative to Trans::Push(Box::new(FooState {})). Use trans_push!(FooState {})
Alternative to Trans::Quit. Use trans_quit!()