Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Should the safe query_interface return a Result<Interface, HResult> instead of a Option<Interface>? #176

Open
rylev opened this issue Oct 20, 2020 · 1 comment
Labels
question Further information is requested

Comments

@rylev
Copy link
Contributor

rylev commented Oct 20, 2020

We assume that if a call to QueryInterface doesn't return success, that the requested interface is not implemented for the backing class. But it is possible that some implementations may return non-standard errors. Should we provide the ability for the user to inspect the error to ensure that E_NOINTERFACE is returned and if not, do something else with the error?

@rylev rylev added the question Further information is requested label Oct 20, 2020
@russcam
Copy link
Contributor

russcam commented Aug 19, 2021

I think Result<T,E> maps better to QueryInterface semantics than Option<T> does, and as you say, provides ability to make a decision on the error, or call .ok() to get an Option<T> to have current behaviour.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Further information is requested
Projects
None yet
Development

No branches or pull requests

2 participants