Function nstd_sys::string::nstd_string_push
source · #[no_mangle]
pub extern "C" fn nstd_string_push(
string: &mut NSTDString<'_>,
chr: NSTDUnichar
) -> NSTDAllocErrorAvailable on crate feature
string only.Expand description
Pushes an NSTDUnichar onto the end of a string.
Parameters:
-
NSTDString *string- The string to append the character to. -
NSTDUnichar chr- The Unicode character to append to the string.
Returns
NSTDAllocError errc - The allocation operation error code.
Example
use nstd_sys::{
alloc::{NSTDAllocError::NSTD_ALLOC_ERROR_NONE, NSTD_ALLOCATOR},
string::{nstd_string_new, nstd_string_push},
};
unsafe {
let mut string = nstd_string_new(&NSTD_ALLOCATOR);
assert!(nstd_string_push(&mut string, '🦀'.into()) == NSTD_ALLOC_ERROR_NONE);
}