It's MVU, but we lost the view along the way...
⚠️ IMPORTANT: This project is under heavy construction and prototyping! Expect breaking changes and incomplete features.
Emyu is a framework for building business logic in Rust using the Model-View-Update (MVU) architecture pattern, but where the View is implemented in a foreign language, such as Dart/Flutter, Java/Kotlin/Android, Swift/iOS, and others.
The most important principle is that, from the perspective of the foreign language, the application is a black box where only the updaters and getters are exposed via FFI. The foreign language code can call the updaters to modify the application state, and it can call the getters to read the application state. The foreign language code is responsible for rendering the UI based on the state it reads from the application.
pub type MyApp = AdHocApp<MyRootModel>;
pub struct MyRootModel {
name: Signal<String>,
age: Signal<i32>,
employed: bool,
}
#[emyu::model(for_app = "MyApp", dispatcher(meta(base(derive(Clone)))))]
pub impl MyRootModel {
pub fn new();
pub fn set_attributes(&mut self, name: String, age: i32, employed: bool) {
self.name.writer().set(name);
self.age.writer().set(age);
self.employed = employed;
}
pub fn name(&self) -> Signal<String>;
pub fn age(&self) -> Signal<i32>;
}Licensed under either of:
- Apache License, Version 2.0, (LICENSE-APACHE or https://www.apache.org/licenses/LICENSE-2.0)
- MIT license (LICENSE-MIT or https://opensource.org/licenses/MIT)
at your option.
Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in these crate(s) by you, as defined in the Apache-2.0 license, shall be dual licensed as above, without any additional terms or conditions.