You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I tried to make some macros, but const features are just not quite stabilized enough to do it with macro_rules, and I'd rather not add a dependency on syn just for this. utf16_lit is a good interim implementations for now, but the technique can only make arrays, then can't currently be converted to slices or this crate's string types in const contexts. Yet. Any one of several unstable features getting stabilized would enable this, so holding off for now.
Rust 1.56 stabilized mem::transmute as const, so I was able to implement the macros. There is a macro for each wide string slice type, including alias macros for WideStr/WideCStr.
Seems to work out well in unit tests. Here's example usage:
There exist quite a handy crate: https://docs.rs/wchar. It provides
wch_c!
macro, which converts a sting literal to&'static [u16]
at compile time.It would be great to have a similar macro in widestring-rs, so you could define
&'static U16CStr
constants.The text was updated successfully, but these errors were encountered: