Guarantee Utf16 output
Opened this issue · 2 comments
Plecra commented
It'd be handy to have a type that guaranteed the encoding like str
does. There could be an optional dependency on something like widestring
, or just a very simple wrapper type that users can write conversions for.
pub struct Utf16([u16]);
impl Utf16 {
pub unsafe fn from_utf16_unchecked(utf16: &[u16]) -> &Self;
pub fn as_wide(&self) -> &[u16];
}
Lokathor commented
I'm not sure if a proc-macro crate can export non-proc-macro items.
If it can, i'd accept some sort of PR for this being an optional thing.
Lokathor commented
oh but this would probably work in v2!