nstd_cstring_new

Function nstd_cstring_new 

Source
#[unsafe(no_mangle)]
pub extern "C" fn nstd_cstring_new( allocator: &NSTDAllocator, ) -> NSTDOptionalCString<'_>
Available on crate feature cstring only.
Expand description

Creates a new empty NSTDCString.

§Parameters:

  • const NSTDAllocator *allocator - The memory allocator.

§Returns

NSTDOptionalCString cstring - The new C string on success, or an uninitialized “none” variant if allocating for the C string’s null terminator fails.

§Example

use nstd_sys::{alloc::NSTD_ALLOCATOR, cstring::nstd_cstring_new};

let cstring = unsafe { nstd_cstring_new(&NSTD_ALLOCATOR) };