@@ -5,7 +5,7 @@ use jni::{
5
5
} ;
6
6
7
7
struct Inner < ' env > {
8
- env : JNIEnv < ' env > ,
8
+ env : & ' env mut JNIEnv < ' env > ,
9
9
object : JObject < ' env > ,
10
10
}
11
11
@@ -16,7 +16,7 @@ pub struct Intent<'env> {
16
16
}
17
17
18
18
impl < ' env > Intent < ' env > {
19
- pub fn from_object ( env : JNIEnv < ' env > , object : JObject < ' env > ) -> Self {
19
+ pub fn from_object ( env : & ' env mut JNIEnv < ' env > , object : JObject < ' env > ) -> Self {
20
20
Self {
21
21
inner : Ok ( Inner { env, object } ) ,
22
22
}
@@ -27,7 +27,7 @@ impl<'env> Intent<'env> {
27
27
Self { inner }
28
28
}
29
29
30
- pub fn new ( mut env : JNIEnv < ' env > , action : impl AsRef < str > ) -> Self {
30
+ pub fn new ( env : & ' env mut JNIEnv < ' env > , action : impl AsRef < str > ) -> Self {
31
31
Self :: from_fn ( || {
32
32
let intent_class = env. find_class ( "android/content/Intent" ) ?;
33
33
let action_view =
@@ -47,7 +47,7 @@ impl<'env> Intent<'env> {
47
47
}
48
48
49
49
pub fn new_with_uri (
50
- mut env : JNIEnv < ' env > ,
50
+ env : & ' env mut JNIEnv < ' env > ,
51
51
action : impl AsRef < str > ,
52
52
uri : impl AsRef < str > ,
53
53
) -> Self {
@@ -93,7 +93,7 @@ impl<'env> Intent<'env> {
93
93
package_name : impl AsRef < str > ,
94
94
class_name : impl AsRef < str > ,
95
95
) -> Self {
96
- self . and_then ( |mut inner| {
96
+ self . and_then ( |inner| {
97
97
let package_name = inner. env . new_string ( package_name) ?;
98
98
let class_name = inner. env . new_string ( class_name) ?;
99
99
@@ -118,7 +118,7 @@ impl<'env> Intent<'env> {
118
118
/// # })
119
119
/// ```
120
120
pub fn with_extra ( self , key : impl AsRef < str > , value : impl AsRef < str > ) -> Self {
121
- self . and_then ( |mut inner| {
121
+ self . and_then ( |inner| {
122
122
let key = inner. env . new_string ( key) ?;
123
123
let value = inner. env . new_string ( value) ?;
124
124
@@ -177,7 +177,7 @@ impl<'env> Intent<'env> {
177
177
/// # })
178
178
/// ```
179
179
pub fn with_type ( self , type_name : impl AsRef < str > ) -> Self {
180
- self . and_then ( |mut inner| {
180
+ self . and_then ( |inner| {
181
181
let jstring = inner. env . new_string ( type_name) ?;
182
182
183
183
inner. env . call_method (
@@ -195,7 +195,7 @@ impl<'env> Intent<'env> {
195
195
let cx = ndk_context:: android_context ( ) ;
196
196
let activity = unsafe { JObject :: from_raw ( cx. context ( ) as jni:: sys:: jobject ) } ;
197
197
198
- self . inner . and_then ( |mut inner| {
198
+ self . inner . and_then ( |inner| {
199
199
inner. env . call_method (
200
200
activity,
201
201
"startActivity" ,
0 commit comments