update at 2022-02-23 23:09:27 by ehlxr

master
ehlxr 2022-02-23 23:09:27 +08:00
parent 21b0ed000d
commit 09406d01da
1 changed files with 3 additions and 3 deletions

View File

@ -15,13 +15,13 @@ pub extern "system" fn Java_me_ehlxr_HelloWorld_fetchNameStr(
{ {
let jstr = env.get_string(JString::from(result)).unwrap(); let jstr = env.get_string(JString::from(result)).unwrap();
// println!("call getNameStr result: {}", String::from(jstr)); // println!("call getNameStr result: {}", String::from(jstr));
format!("Hello, {}! from Rust..", String::from(jstr)) String::from(jstr)
} else { } else {
format!("Hello! from Rust..") "".to_string()
}; };
let output = env let output = env
.new_string(out_str) .new_string(format!("Hello{}! from Rust..", out_str))
.expect("Couldn't create java string!"); .expect("Couldn't create java string!");
output.into_inner() output.into_inner()
} }