Rename app_init to android_init

This commit is contained in:
iris committed 2026-09-11 12:36:50 -04:00
1 parent c3122301b4
commit 40e7259d99
11 files changed
+15 -15

No files matched your search

+1 -1
View File
@@ -10,7 +10,7 @@ impl AndroidAppState for State {
type Resources = Resources; type Resources = Resources;
} }
#[iris::app_init] #[iris::android_init]
fn create(mut ui_state: AndroidUiState, rsc: &mut Resources) -> State { fn create(mut ui_state: AndroidUiState, rsc: &mut Resources) -> State {
rsc.launches += 1; rsc.launches += 1;
rect(PaintId::RED) rect(PaintId::RED)
+1 -1
View File
@@ -3,7 +3,7 @@ use iris::prelude::*;
#[path = "lib.rs"] #[path = "lib.rs"]
mod app; mod app;
#[iris::app_init] #[iris::android_init]
fn create( fn create(
ui_state: &mut AndroidUiState, ui_state: &mut AndroidUiState,
rsc: &mut StdRsc<AndroidUiState>, rsc: &mut StdRsc<AndroidUiState>,
+1 -1
View File
@@ -3,7 +3,7 @@ use iris::prelude::*;
#[path = "lib.rs"] #[path = "lib.rs"]
mod app; mod app;
#[iris::app_init] #[iris::android_init]
fn create( fn create(
ui_state: &mut AndroidUiState, ui_state: &mut AndroidUiState,
rsc: &mut StdRsc<AndroidUiState>, rsc: &mut StdRsc<AndroidUiState>,
+1 -1
View File
@@ -3,7 +3,7 @@ use iris::prelude::*;
#[path = "lib.rs"] #[path = "lib.rs"]
mod app; mod app;
#[iris::app_init] #[iris::android_init]
fn create( fn create(
ui_state: &mut AndroidUiState, ui_state: &mut AndroidUiState,
rsc: &mut StdRsc<AndroidUiState>, rsc: &mut StdRsc<AndroidUiState>,
+1 -1
View File
@@ -22,7 +22,7 @@ impl AndroidAppState for Client {
} }
} }
#[iris::app_init] #[iris::android_init]
fn create(mut ui_state: AndroidUiState, rsc: &mut StdRsc<Client>) -> Client { fn create(mut ui_state: AndroidUiState, rsc: &mut StdRsc<Client>) -> Client {
let widgets = app::build(rsc, &mut ui_state); let widgets = app::build(rsc, &mut ui_state);
app::update_info(rsc, widgets.info, 0); app::update_info(rsc, widgets.info, 0);
+1 -1
View File
@@ -3,7 +3,7 @@ use iris::prelude::*;
#[path = "lib.rs"] #[path = "lib.rs"]
mod app; mod app;
#[iris::app_init] #[iris::android_init]
fn create( fn create(
ui_state: &mut AndroidUiState, ui_state: &mut AndroidUiState,
rsc: &mut StdRsc<AndroidUiState>, rsc: &mut StdRsc<AndroidUiState>,
+1 -1
View File
@@ -3,7 +3,7 @@ use iris::prelude::*;
#[path = "lib.rs"] #[path = "lib.rs"]
mod app; mod app;
#[iris::app_init] #[iris::android_init]
fn create( fn create(
ui_state: &mut AndroidUiState, ui_state: &mut AndroidUiState,
rsc: &mut StdRsc<AndroidUiState>, rsc: &mut StdRsc<AndroidUiState>,
+4 -4
View File
@@ -19,11 +19,11 @@ use syn::{
/// JNI glue is Android-gated; the annotated function therefore does not need /// JNI glue is Android-gated; the annotated function therefore does not need
/// its own `cfg` attribute. /// its own `cfg` attribute.
#[proc_macro_attribute] #[proc_macro_attribute]
pub fn app_init(args: TokenStream, item: TokenStream) -> TokenStream { pub fn android_init(args: TokenStream, item: TokenStream) -> TokenStream {
if !args.is_empty() { if !args.is_empty() {
return Error::new( return Error::new(
proc_macro2::Span::call_site(), proc_macro2::Span::call_site(),
"app_init takes no arguments", "android_init takes no arguments",
) )
.into_compile_error() .into_compile_error()
.into(); .into();
@@ -44,7 +44,7 @@ pub fn app_init(args: TokenStream, item: TokenStream) -> TokenStream {
{ {
return Error::new( return Error::new(
function.sig.inputs.span(), function.sig.inputs.span(),
"an app_init function takes UI state and resources", "an android_init function takes UI state and resources",
) )
.into_compile_error() .into_compile_error()
.into(); .into();
@@ -56,7 +56,7 @@ pub fn app_init(args: TokenStream, item: TokenStream) -> TokenStream {
{ {
return Error::new( return Error::new(
function.sig.span(), function.sig.span(),
"an app_init function must be a plain, non-generic synchronous function", "an android_init function must be a plain, non-generic synchronous function",
) )
.into_compile_error() .into_compile_error()
.into(); .into();
+2 -2
View File
@@ -25,7 +25,7 @@ application-id = "com.example.myapp"
label = "My app" label = "My app"
``` ```
`#[iris::app_init]` marks the initializer called when Android creates the Iris `#[iris::android_init]` marks the initializer called when Android creates the Iris
view. The attribute supplies its own Android target gate and generates the JNI view. The attribute supplies its own Android target gate and generates the JNI
loader glue. An application with no state beyond the UI state receives loader glue. An application with no state beyond the UI state receives
`AndroidUiState` directly by mutable reference: `AndroidUiState` directly by mutable reference:
@@ -37,7 +37,7 @@ fn build<Rsc: UiRsc>(rsc: &mut Rsc, ui_state: &mut impl HasRoot<Rsc>) {
rect(PaintId::RED).set_root(rsc, ui_state); rect(PaintId::RED).set_root(rsc, ui_state);
} }
#[iris::app_init] #[iris::android_init]
fn create( fn create(
ui_state: &mut AndroidUiState, ui_state: &mut AndroidUiState,
rsc: &mut StdRsc<AndroidUiState>, rsc: &mut StdRsc<AndroidUiState>,
+1 -1
View File
@@ -14,7 +14,7 @@ pub use view::{
WindowInsets, new_peer, WindowInsets, new_peer,
}; };
/// Types used by `#[iris::app_init]`'s generated JNI boundary. /// Types used by `#[iris::android_init]`'s generated JNI boundary.
#[doc(hidden)] #[doc(hidden)]
pub mod __private { pub mod __private {
pub use android_view::{Context, View, jni::JNIEnv}; pub use android_view::{Context, View, jni::JNIEnv};
+1 -1
View File
@@ -27,7 +27,7 @@ mod layout_tests;
pub use image; pub use image;
pub use iris_core as core; pub use iris_core as core;
pub use iris_macro as macros; pub use iris_macro as macros;
pub use iris_macro::app_init; pub use iris_macro::android_init;
pub mod prelude { pub mod prelude {
use super::*; use super::*;