Open SimonSapin opened 6 years ago
Interesting approach. I'd suggest checking explicitly against S_OK
in from_out_param
. COM APIs are known to return S_FALSE
sometimes without actually filling in the out param. In that case the caller should probably treat S_FALSE
like an error and handle it differently.
Concerning the naming, C++/WinRT uses put().
That’s not quite the same. That put()
method doen’t do the whole “create a (null) pointer, then mutate it through a callback, then check whether return value indicates an error” dance.
I’ve added the API below through an extension trait. Do you think it would make sense to have as inherent methods in this crate? I can send a PR. I’m not sure about the method names, though.