nstd_core_cstr_len

Function nstd_core_cstr_len 

Source
#[unsafe(no_mangle)]
pub const extern "C" fn nstd_core_cstr_len( cstr: &NSTDCStr, ) -> NSTDUInt
Available on crate feature core only.
Expand description

Returns the length of a C string slice.

§Parameters:

  • const NSTDCStr *cstr - The C string slice.

§Returns

NSTDUInt len - The length of the C string slice.

§Example

use nstd_sys::core::cstr::{nstd_core_cstr_from_raw, nstd_core_cstr_len};

unsafe {
    let str = "Sunflower seeds yum\0";
    let cstr = nstd_core_cstr_from_raw(str.as_ptr().cast());
    assert!(nstd_core_cstr_len(&cstr) == 19);
}