rust-mobile / rust-mobile/ndk

Unify lifetime handling for `NativeWindow` and `HardwareBuffer`

Open
#309 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

difficulty: average priority: low status: needs investigation type: enhancement
Dominant language
Rust
Stars
1.3k
Forks
125
PR merge metrics
No merged PRs in 30d

Description

See https://github.com/rust-windowing/android-ndk-rs/pull/296#issuecomment-1153288154, there are multiple ways we can approach this.

Something based on borrows (Like how String + &str work together) has my preference, but we can't give any sensible lifetime to for example what fn native_window() returns (which we currently have to forcibly _acquire to make it valid). Alas, we'll probably remove those static getters anyway in light of recent suggestions and to support multi-Activity, so this specific case wouldn't affect us anymore. At which point a borrow-based approach might as well work out :)

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reading PR #296 and its linked issue comment, then inspect the lifetime handling for NativeWindow and HardwareBuffer, including the native_window() getter. Compare the borrow-based approach with the other approaches discussed and account for removing static getters to support multiple Activities. Done means the two types have unified lifetime handling without relying on the current forced _acquire behavior.

Written by the indexing model from the issue text.

Assessment

Tech stack
android, rust
Domain
mobile-dev
Issue type
Refactor
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.