Skip to content

Commit 9fce890

Browse files
authored
Merge pull request #143 from rust-mobile/readme-update-versions
README: Update crate version in `Cargo.toml` example
2 parents 2deec16 + a84722f commit 9fce890

File tree

5 files changed

+20
-24
lines changed

5 files changed

+20
-24
lines changed

.github/workflows/ci.yml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -17,13 +17,13 @@ jobs:
1717
fail-fast: false
1818
matrix:
1919
# See top README for MSRV policy
20-
rust_version: [1.68.0, stable]
20+
rust-version: [1.68.0, stable]
2121
steps:
2222
- uses: actions/checkout@v4
2323

2424
- uses: hecrj/setup-rust-action@v2
2525
with:
26-
rust-version: ${{ matrix.rust_version }}
26+
rust-version: ${{ matrix.rust-version }}
2727

2828
- name: Install Rust targets
2929
run: >
@@ -57,7 +57,7 @@ jobs:
5757
build --features native-activity
5858
5959
- name: Build agdk-mainloop example
60-
if: matrix.rust_version == 'stable'
60+
if: matrix.rust-version == 'stable'
6161
working-directory: examples/agdk-mainloop
6262
run: >
6363
cargo ndk
@@ -68,7 +68,7 @@ jobs:
6868
-o app/src/main/jniLibs/ -- build
6969
7070
- name: Build na-mainloop example
71-
if: matrix.rust_version == 'stable'
71+
if: matrix.rust-version == 'stable'
7272
working-directory: examples/na-mainloop
7373
run: >
7474
cargo ndk

README.md

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
[![ci](https://github.com/rust-mobile/android-activity/actions/workflows/ci.yml/badge.svg)](https://github.com/rust-mobile/android-activity/actions/workflows/ci.yml)
44
[![crates.io](https://img.shields.io/crates/v/android-activity.svg)](https://crates.io/crates/android-activity)
55
[![Docs](https://docs.rs/android-activity/badge.svg)](https://docs.rs/android-activity)
6-
[![MSRV](https://img.shields.io/badge/rustc-1.64.0+-ab6000.svg)](https://blog.rust-lang.org/2022/09/22/Rust-1.64.0.html)
6+
[![MSRV](https://img.shields.io/badge/rustc-1.68.0+-ab6000.svg)](https://blog.rust-lang.org/2023/03/09/Rust-1.68.0.html)
77

88
## Overview
99

@@ -36,8 +36,8 @@ Cargo.toml
3636
```toml
3737
[dependencies]
3838
log = "0.4"
39-
android_logger = "0.11"
40-
android-activity = { version = "0.4", features = [ "native-activity" ] }
39+
android_logger = "0.13"
40+
android-activity = { version = "0.5", features = [ "native-activity" ] }
4141

4242
[lib]
4343
crate_type = ["cdylib"]
@@ -126,8 +126,8 @@ Middleware libraries can instead look at using the [ndk-context](https://crates.
126126
The steps to switch a simple standalone application over from `ndk-glue` to `android-activity` (still based on `NativeActivity`) should be:
127127

128128
1. Remove `ndk-glue` from your Cargo.toml
129-
2. Add a dependency on `android-activity`, like `android-activity = { version="0.4", features = [ "native-activity" ] }`
130-
3. Optionally add a dependency on `android_logger = "0.11.0"`
129+
2. Add a dependency on `android-activity`, like `android-activity = { version="0.5", features = [ "native-activity" ] }`
130+
3. Optionally add a dependency on `android_logger = "0.13.0"`
131131
4. Update the `main` entry point to look like this:
132132

133133
```rust
@@ -157,8 +157,8 @@ Prior to working on android-activity, the existing glue crates available for bui
157157
## MSRV
158158

159159
We aim to (at least) support stable releases of Rust from the last three months. Rust has a 6 week release cycle which means we will support the last three stable releases.
160-
For example, when Rust 1.69 is released we would limit our `rust_version` to 1.67.
160+
For example, when Rust 1.69 is released we would limit our `rust-version` to 1.67.
161161

162-
We will only bump the `rust_version` at the point where we either depend on a new features or a dependency has increased its MSRV, and we won't be greedy. In other words we will only set the MSRV to the lowest version that's _needed_.
162+
We will only bump the `rust-version` at the point where we either depend on a new features or a dependency has increased its MSRV, and we won't be greedy. In other words we will only set the MSRV to the lowest version that's _needed_.
163163

164-
MSRV updates are not considered to be inherently semver breaking (unless a new feature is exposed in the public API) and so a `rust_version` change may happen in patch releases.
164+
MSRV updates are not considered to be inherently semver breaking (unless a new feature is exposed in the public API) and so a `rust-version` change may happen in patch releases.

android-activity/src/game_activity/mod.rs

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -764,18 +764,16 @@ impl<'a> From<Arc<InputReceiver>> for InputIteratorInner<'a> {
764764
let buffered = unsafe {
765765
let app_ptr = receiver.native_app.as_ptr();
766766
let input_buffer = ffi::android_app_swap_input_buffers(app_ptr);
767-
if input_buffer.is_null() {
768-
None
769-
} else {
770-
let buffer = InputBuffer::from_ptr(NonNull::new_unchecked(input_buffer));
767+
NonNull::new(input_buffer).map(|input_buffer| {
768+
let buffer = InputBuffer::from_ptr(input_buffer);
771769
let keys_iter = KeyEventsLendingIterator::new(&buffer);
772770
let motion_iter = MotionEventsLendingIterator::new(&buffer);
773-
Some(BufferedEvents::<'a> {
771+
BufferedEvents::<'a> {
774772
buffer,
775773
keys_iter,
776774
motion_iter,
777-
})
778-
}
775+
}
776+
})
779777
};
780778

781779
let native_app = receiver.native_app.clone();

android-activity/src/lib.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -112,6 +112,8 @@
112112
//! [`GameActivity`]: https://developer.android.com/games/agdk/integrate-game-activity
113113
//! [Looper]: https://developer.android.com/reference/android/os/Looper
114114
115+
#![deny(clippy::manual_let_else)]
116+
115117
use std::hash::Hash;
116118
use std::sync::Arc;
117119
use std::sync::RwLock;

android-activity/src/native_activity/mod.rs

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -485,11 +485,7 @@ impl<'a> InputIteratorInner<'a> {
485485
where
486486
F: FnOnce(&input::InputEvent) -> InputStatus,
487487
{
488-
// XXX: would use `let Some(queue) = &self.receiver.queue else { return
489-
// false; }` but we're stuck supporting Rust 1.64 for Winit currently
490-
let queue = if let Some(queue) = &self.receiver.queue {
491-
queue
492-
} else {
488+
let Some(queue) = &self.receiver.queue else {
493489
log::trace!("no queue available for events");
494490
return false;
495491
};

0 commit comments

Comments
 (0)