Closed DavisVaughan closed 11 months ago
This boils down to the question of why does NoValue
exist, in the first place.
In an ideal world, with a Windows API being perfectly well-designed, there would be no need for NoValue
. The zero in any flag would mean the absence of flags, whose possibility would be represented by Option<co::FOO>
in Rust's terms.
This is far from the reality, obviously.
So NoValue
is an escape hatch for holes in the type system, which works for almost all constant types, but not all, because some of them do have the zero as an actual flag value.
Now,
Is there a reason that
MBC::NoValue exists
, butWC::NoValue
doesn't?
The only reason is that I didn't notice the use case. But you are correct, and I'm implementing right now.
Is there a reason that
MBC::NoValue
exists, butWC::NoValue
doesn't?https://github.com/rodrigocfd/winsafe/blob/4ffb4a2b042570d3aec7b1aba09cac18026f390e/src/kernel/co/consts.rs#L784-L796
https://github.com/rodrigocfd/winsafe/blob/4ffb4a2b042570d3aec7b1aba09cac18026f390e/src/kernel/co/consts.rs#L2249-L2259
According to https://learn.microsoft.com/en-us/windows/win32/api/stringapiset/nf-stringapiset-widechartomultibyte#parameters:
Similar to what it says for
MultiByteToWideChar
, so I think I was expectingNoValue
here too