MCPcopy Create free account
hub / github.com/astonbitecode/j4rs / to_rust_string

Function to_rust_string

rust/src/utils.rs:29–32  ·  view source on GitHub ↗
(pointer: *const c_char)

Source from the content-addressed store, hash-verified

27use crate::{cache, errors, InvocationArg, JavaClass};
28
29pub(crate) unsafe fn to_rust_string(pointer: *const c_char) -> errors::Result<String> {
30 let slice = CStr::from_ptr(pointer).to_bytes();
31 Ok(from_java_cesu8(slice)?.to_string())
32}
33
34pub(crate) fn to_c_string(string: &str) -> *mut c_char {
35 let cs = CString::new(string.as_bytes()).unwrap();

Callers 2

string_from_jobjectFunction · 0.85
jstring_to_rust_stringFunction · 0.85

Calls 1

to_stringMethod · 0.80

Tested by

no test coverage detected