#[unsafe(no_mangle)]pub unsafe extern "C" fn nstd_core_str_len(str: &NSTDStr) -> NSTDUIntAvailable on crate feature
core only.Expand description
Returns the number of Unicode characters in a string slice.
§Parameters:
const NSTDStr *str- The string slice.
§Returns
NSTDUInt len - The length of the string slice.
§Safety
This operation can cause undefined behavior in the event that str’s data is invalid.
§Example
use nstd_sys::core::str::{nstd_core_str_len, nstd_core_str_from_raw_cstr};
let s_str = "Hello, 🌎!\0";
unsafe {
let str = nstd_core_str_from_raw_cstr(s_str.as_ptr().cast()).unwrap();
assert!(nstd_core_str_len(&str) == 9);
}