I have an static mutable value:
static mut ADDRESS: &'static str = "";
It is global, not in any function.
And now i have a problem:
I have functions that read this value, them working correctly, but when i tried to make function that change this value from arguments - it start crying that value "does't live long enough".
#[no_mangle]
pub unsafe extern fn Java_Rust_setAddress(
env: JNIEnv,
_: JClass,
address: JString
) {
let input: String = env.get_string(address).expect("Couldn't get java string!").into();
ADDRESS = &input /Error there/
}
What can i do with it? Transfering address in each case is not a variant, i really need a simple global variable.
ADDRESS = input.as_str()
not works too.
But
ADDRESS = "Something"
works good.