Skip to main content

nova_rt_bytes_to_string_unchecked

Function nova_rt_bytes_to_string_unchecked 

Source
#[unsafe(no_mangle)]
pub unsafe extern "C" fn nova_rt_bytes_to_string_unchecked( b: *const NovaStr, ) -> *mut NovaStr
Expand description

b’s bytes as a String, without checking UTF-8 validity.

The caller must have established validity with nova_rt_bytes_is_utf8 first; std/bytes’s to_string is the only caller and does exactly that. This copies b’s bytes into a fresh buffer via gc_bytes — an invalid String would be unsound, which is why the check is not optional.

§Safety

b must point to a live NovaStr whose bytes are valid UTF-8.