microsoft / windows-rs

Rust for Windows
https://kennykerr.ca/rust-getting-started/
Apache License 2.0
10.1k stars 473 forks source link

Add `OsString` support to `windows-registry` crate #3121

Closed kennykerr closed 1 week ago

kennykerr commented 1 week ago

Fixes: #3119

kennykerr commented 1 week ago

Wow, that's quite the bizarre nightly behavior. 🤪

image

kennykerr commented 1 week ago

Looks like that's a rustfmt bug:

https://github.com/rust-lang/rustfmt/issues/6210 https://github.com/rust-lang/rust/pull/126888

ChrisDenton commented 1 week ago

Oh it just occurred to me that maybe we could just return a HSTRING or a Vec<u16> and let users turn that into a OsString or whatever they want. It's less ergonomic for the OsString case but more flexible in general.

kennykerr commented 1 week ago

Yes, I thought about using HSTRING instead. It's way better and provides convertibility with OsString. I just need to pull HSTRING and friends into a new windows-strings crate before I can add a dependency from windows-registry. I need to do that anyway, so perhaps I'll wait on this PR and we can just use HSTRING here.

ChrisDenton commented 1 week ago

To be honest, that does sound a lot more appealing to me now that I've considered it some more.