[−][src]Crate yarte_wasm_app
Yarte wasm application
A simple single thread reactor pattern with a doubly-linked list as dequeue.
Intended to be used as a singleton and static.
Implement without yarte derive
The cycle of App methods is:
init
:App.__hydrate(&mut self, _addr: &'static Addr<Self>)
update
on message
:- enqueue message
- is ready? ->
update
update
- pop message? ->
App.__dispatch(&mut self, _msg: Self::Message, _addr: &'static Addr<Self>)
- is queue empty? ->
App.__render(&mut self, _addr: &'static Addr<Self>)
- is queue not empty? ->
update
. It is not recursive
- pop message? ->
Why no backpressure?
Because you don't need it because you don't need a runtime to poll wasm futures. Backpressure can be implemented for future it is needed and carry static reference to the Address of the App.
Why no RC?
Because you don't need it because it is thinking to be implemented as singleton and static.
Why doubly-linked list?
Is simpler than grow array implementation and it will never be a bottleneck in a browser. But in the future it can be implemented.
Macros
run | Macro to create a |
Structs
Addr | The address of App |
Context | Encapsulate inner context of the App |
Traits
App | App are object which encapsulate state and behavior |