-
-
Notifications
You must be signed in to change notification settings - Fork 7
Open
Description
I am working on a JavaScript runtime, and I would like to add a no-copy way to send strings to the JS engine. The API for this requires me to pass in a raw *const u16 along with its length. (The problem of u16 vs u8 is not an issue here.)
It would be nice for there to be functions as follows:
impl<Endian> WString<Endian> {
pub unsafe fn from_raw_parts(ptr: *mut u8, len: usize, capacity: usize) -> Self;
pub fn into_raw_parts(self) -> (*mut u8, usize, usize);
}I am aware this can be emulated with WString::into_bytes, followed by the same functions on Vec but it would be more convenient to have them on WString directly and would also bypass the process of checking the bytes are valid UTF-16.
Metadata
Metadata
Assignees
Labels
No labels