Closed Boddlnagg closed 6 years ago
I appreciate your suggestion. wstrz!
must be great, which I had not thought about it completely.
The feature will be implemented soon, with a new version number, 0.2.0.
Oh sorry, I missed the sentence about interior nulls.
Adding the limitation is easy work, but it should be careful, because there are some Win32 API's requiring nulls in the middle of string, like OPENFILENAME::lpstrFilter
. Furthermore, wstr!
allows nulls in strings, so I think wstrz!
also should have same behavior.
@nitric1 Thanks for the change, and don't worry about interior nuls ... I just found out that WinRT can deal with interior nuls just fine!
Thanks for this very useful crate! I had been looking for such a thing for a long time 👍
WinRT's
HString
s are null-terminated UTF16 strings. To be able to use literals without runtime allocation, it would be great if this crate would offer an additional macro variant with an added null terminator (e.g.wstrz!
), which I could then wrap in a simple(see https://github.com/contextfree/winrt-rust/blob/5deb9e19a2397d5b5bc48097a417b104b0dec6fe/src/hstring.rs#L74 for the definition of
HStringReference
)I tried
wstr!(concat!($str, "\0"))
, but it complains thatinput must be string literal
. It would also be great ifwstrz!
could ensure that there are no interior nulls.