Align desktop initializer arguments with builders
This commit is contained in:
1 parent
166bac2a93
commit
18685da28b
6 files changed
+13
-13
No files matched your search
@@ -33,21 +33,23 @@ loader glue. An application with no state beyond the UI state receives
|
||||
```rust
|
||||
use iris::prelude::*;
|
||||
|
||||
fn build<Rsc: UiRsc>(rsc: &mut Rsc, ui_state: &mut impl HasRoot<Rsc>) {
|
||||
rect(PaintId::RED).set_root(rsc, ui_state);
|
||||
}
|
||||
|
||||
#[iris::app_init]
|
||||
fn create(
|
||||
ui_state: &mut AndroidUiState,
|
||||
rsc: &mut StdRsc<AndroidUiState>,
|
||||
) {
|
||||
rect(PaintId::RED).set_root(rsc, ui_state);
|
||||
build(rsc, ui_state);
|
||||
}
|
||||
```
|
||||
|
||||
Desktop has the corresponding initializer form:
|
||||
|
||||
```rust
|
||||
DesktopApp::<DesktopUiState>::run_with(|ui_state, rsc| {
|
||||
rect(PaintId::RED).set_root(rsc, ui_state);
|
||||
});
|
||||
DesktopApp::<DesktopUiState>::run_with(build);
|
||||
```
|
||||
|
||||
Background work updates either host through the same task context. An update
|
||||
|
||||
Reference in new issue
Block a user