[−][src]Crate yarte_wasm_app
Yarte wasm application
A simple reactor pattern
Intended to be used as a singleton and static with single state
Only 101% rust safe in nightly
Architecture
Cycle
The cycle of App methods is:
init
:__hydrate(&mut self, _addr: A<Self>)
on message
:- enqueue message
- is ready? ->
update
update
- pop message? ->
__dispatch(&mut self, _msg: Self::Message, _addr: A<Self>)
- is queue empty? ->
__render(&mut self, _addr: A<Self>)
- is queue not empty? ->
update
- pop message? ->
Virtual DOM and differences in tree
The virtual DOM model and the difference calculation in the node tree differs from all previous implementations in many ways. The main aspect that is not found in any other implementation is that it accumulates the changes in a tree of differences equivalent space dimension is less or equal than html node tree equivalent space dimension.
It's compiled with static linking of the modules that allows to detect local fixed points at compile time and change the base of the difference linear map. That is, instead of making the difference in the html nodes, it make the difference on a tree of differences write at process line.
With what allows a reduction of the dimension of the domain and strong optimizations in parallel.
Unsafe code and controversies
Why no RC?
Because you don't need it because it is thinking to be implemented as singleton and static.
Whe no RefCell?
Because you don't need it because all uniques (mutable) references are made in atomic functions,
run!
is designed for assure unique owner of all App
is Addr
and its unique safe method
is send
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 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.
Re-exports
pub use self::A as DeLorean; |
Macros
run | Macro to create a |
Structs
A | DeLorean for your app. Easy and safe traveling to the future in your thread and the nightly |
Addr | The address of App |
Context | Encapsulate inner context of the App |
Traits
App | App are object which encapsulate state and behavior |