Trait JsStringLike

pub trait JsStringLike: IntoWasmAbi + OptionIntoWasmAbi + JsStringLikeSealed

Marker for types that cross the ABI as a JavaScript string.

Use as a bound on an experimental_generic_mono import's type parameter to accept any Rust or JS string shape, each at its native wire format: String and &str cross as UTF-8 buffers, js_sys::JsString and &js_sys::JsString as handles — all arriving in JS as a string value.

This trait is sealed: it is implemented only for the string shapes above, each of which is guaranteed to produce a JS string on the other side.

OptionIntoWasmAbi is a supertrait so that nullable string positions (Option<T>) work under the same bound.

This trait is experimental, like experimental_generic_mono itself, and may change or be removed as that feature stabilizes.

Implementors