Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Guarantee Utf16 output #7

Open
Plecra opened this issue Oct 13, 2020 · 2 comments
Open

Guarantee Utf16 output #7

Plecra opened this issue Oct 13, 2020 · 2 comments

Comments

@Plecra
Copy link
Contributor

Plecra commented Oct 13, 2020

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
Copy link
Owner

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
Copy link
Owner

oh but this would probably work in v2!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants