Skip to content

Commit 74d9669

Browse files
committed
Document that AndroidApp is cheaply clonable
Fixes: #125
1 parent a92237f commit 74d9669

File tree

1 file changed

+24
-0
lines changed

1 file changed

+24
-0
lines changed

android-activity/src/lib.rs

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,18 @@
3535
//! marshalled between the Java thread that owns the `Activity` and the native
3636
//! thread that runs the `android_main()` code.
3737
//!
38+
//! # Cheaply Clonable [`AndroidApp`]
39+
//!
40+
//! [`AndroidApp`] is intended to be something that can be cheaply passed around
41+
//! by referenced within an application. It is reference counted and can be
42+
//! cheaply cloned.
43+
//!
44+
//! # `Send` and `Sync` [`AndroidApp`]
45+
//!
46+
//! Although an [`AndroidApp`] implements `Send` and `Sync` you do need to take
47+
//! into consideration that some APIs, such as [`AndroidApp::poll_events()`] are
48+
//! explicitly documented to only be usable from your `android_main()` thread.
49+
//!
3850
//! # Main Thread Initialization
3951
//!
4052
//! Before `android_main()` is called, the following application state
@@ -489,6 +501,18 @@ bitflags! {
489501
/// marshalled between the Java thread that owns the `Activity` and the native
490502
/// thread that runs the `android_main()` code.
491503
///
504+
/// # Cheaply Clonable [`AndroidApp`]
505+
///
506+
/// [`AndroidApp`] is intended to be something that can be cheaply passed around
507+
/// by referenced within an application. It is reference counted and can be
508+
/// cheaply cloned.
509+
///
510+
/// # `Send` and `Sync` [`AndroidApp`]
511+
///
512+
/// Although an [`AndroidApp`] implements `Send` and `Sync` you do need to take
513+
/// into consideration that some APIs, such as [`AndroidApp::poll_events()`] are
514+
/// explicitly documented to only be usable from your `android_main()` thread.
515+
///
492516
#[derive(Debug, Clone)]
493517
pub struct AndroidApp {
494518
pub(crate) inner: Arc<RwLock<AndroidAppInner>>,

0 commit comments

Comments
 (0)