Rename app_init to android_init
This commit is contained in:
1 parent
c3122301b4
commit
40e7259d99
11 files changed
+15
-15
No files matched your search
@@ -10,7 +10,7 @@ impl AndroidAppState for State {
|
||||
type Resources = Resources;
|
||||
}
|
||||
|
||||
#[iris::app_init]
|
||||
#[iris::android_init]
|
||||
fn create(mut ui_state: AndroidUiState, rsc: &mut Resources) -> State {
|
||||
rsc.launches += 1;
|
||||
rect(PaintId::RED)
|
||||
|
||||
@@ -3,7 +3,7 @@ use iris::prelude::*;
|
||||
#[path = "lib.rs"]
|
||||
mod app;
|
||||
|
||||
#[iris::app_init]
|
||||
#[iris::android_init]
|
||||
fn create(
|
||||
ui_state: &mut AndroidUiState,
|
||||
rsc: &mut StdRsc<AndroidUiState>,
|
||||
|
||||
@@ -3,7 +3,7 @@ use iris::prelude::*;
|
||||
#[path = "lib.rs"]
|
||||
mod app;
|
||||
|
||||
#[iris::app_init]
|
||||
#[iris::android_init]
|
||||
fn create(
|
||||
ui_state: &mut AndroidUiState,
|
||||
rsc: &mut StdRsc<AndroidUiState>,
|
||||
|
||||
@@ -3,7 +3,7 @@ use iris::prelude::*;
|
||||
#[path = "lib.rs"]
|
||||
mod app;
|
||||
|
||||
#[iris::app_init]
|
||||
#[iris::android_init]
|
||||
fn create(
|
||||
ui_state: &mut AndroidUiState,
|
||||
rsc: &mut StdRsc<AndroidUiState>,
|
||||
|
||||
@@ -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 {
|
||||
let widgets = app::build(rsc, &mut ui_state);
|
||||
app::update_info(rsc, widgets.info, 0);
|
||||
|
||||
@@ -3,7 +3,7 @@ use iris::prelude::*;
|
||||
#[path = "lib.rs"]
|
||||
mod app;
|
||||
|
||||
#[iris::app_init]
|
||||
#[iris::android_init]
|
||||
fn create(
|
||||
ui_state: &mut AndroidUiState,
|
||||
rsc: &mut StdRsc<AndroidUiState>,
|
||||
|
||||
@@ -3,7 +3,7 @@ use iris::prelude::*;
|
||||
#[path = "lib.rs"]
|
||||
mod app;
|
||||
|
||||
#[iris::app_init]
|
||||
#[iris::android_init]
|
||||
fn create(
|
||||
ui_state: &mut AndroidUiState,
|
||||
rsc: &mut StdRsc<AndroidUiState>,
|
||||
|
||||
+4
-4
@@ -19,11 +19,11 @@ use syn::{
|
||||
/// JNI glue is Android-gated; the annotated function therefore does not need
|
||||
/// its own `cfg` 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() {
|
||||
return Error::new(
|
||||
proc_macro2::Span::call_site(),
|
||||
"app_init takes no arguments",
|
||||
"android_init takes no arguments",
|
||||
)
|
||||
.into_compile_error()
|
||||
.into();
|
||||
@@ -44,7 +44,7 @@ pub fn app_init(args: TokenStream, item: TokenStream) -> TokenStream {
|
||||
{
|
||||
return Error::new(
|
||||
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();
|
||||
@@ -56,7 +56,7 @@ pub fn app_init(args: TokenStream, item: TokenStream) -> TokenStream {
|
||||
{
|
||||
return Error::new(
|
||||
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();
|
||||
|
||||
@@ -25,7 +25,7 @@ application-id = "com.example.myapp"
|
||||
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
|
||||
loader glue. An application with no state beyond the UI state receives
|
||||
`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);
|
||||
}
|
||||
|
||||
#[iris::app_init]
|
||||
#[iris::android_init]
|
||||
fn create(
|
||||
ui_state: &mut AndroidUiState,
|
||||
rsc: &mut StdRsc<AndroidUiState>,
|
||||
|
||||
+1
-1
@@ -14,7 +14,7 @@ pub use view::{
|
||||
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)]
|
||||
pub mod __private {
|
||||
pub use android_view::{Context, View, jni::JNIEnv};
|
||||
|
||||
+1
-1
@@ -27,7 +27,7 @@ mod layout_tests;
|
||||
pub use image;
|
||||
pub use iris_core as core;
|
||||
pub use iris_macro as macros;
|
||||
pub use iris_macro::app_init;
|
||||
pub use iris_macro::android_init;
|
||||
|
||||
pub mod prelude {
|
||||
use super::*;
|
||||
|
||||
Reference in new issue
Block a user