Skip to main content

read_string_arg

Function read_string_arg 

Source
pub fn read_string_arg<T>(
    caller: &mut Caller<'_, T>,
    arg: Option<Rooted<ArrayRef>>,
) -> Result<Option<String>>
Expand description

Reads a $i8_array arg ref into a Rust String. None is returned for null refs (the wasm-level (ref null $i8_array) param’s null state). The underlying byte storage is i8 (mutable per register_type("i8_array")), so each element is read via array.get_u semantics and assembled into a Vec<u8> then UTF-8 validated. Non-UTF-8 bytes surface as a structured trap rather than a silent replacement.