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
Most COM and Win32 apps #define UNICODE and prefer the W APIs which take PWSTR or PCWSTR. Rust has built-in String::encode_utf16 and String::from_utf16 methods, it would be great if PWSTR and PCWSTR could implement From/Into traits to encapsulate that.
It's tricky since it needs extra storage, but maybe the tuple could be extended with an , Option<Vec<u16>> to hold the extra allocation, and the .0 could point to that when this is used.
The text was updated successfully, but these errors were encountered:
This already works for input parameters. You can pass a string to any function expecting a PSTR or PWSTR and it will create the null-terminated string of the appropriate encoding. For example, the following just works today:
Most COM and Win32 apps
#define UNICODE
and prefer theW
APIs which takePWSTR
orPCWSTR
. Rust has built-inString::encode_utf16
andString::from_utf16
methods, it would be great ifPWSTR
andPCWSTR
could implementFrom
/Into
traits to encapsulate that.It's tricky since it needs extra storage, but maybe the tuple could be extended with an
, Option<Vec<u16>>
to hold the extra allocation, and the.0
could point to that when this is used.The text was updated successfully, but these errors were encountered: