You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Many classes implement other interfaces besides their main interface. For example, Windows.System.LauncherOptions implements ILauncherOptions, but also ILauncherViewOptions, ILauncherOptions2 and ILauncherOptions3. QueryInterface can be used to get implementations of these other interfaces, but can generally query arbitrary interfaces and might fail if the interface is not actually available, therefore it returns Result<>. We should add a way to query those interfaces that are known to be valid (from the metadata), which can then be returned directly.
Maybe this could make use of Rust's conversion traits. Ideally it could work automatically, so that an instance of ComPtr<LauncherOptions>, which allows calls to methods defined on ILauncherOptions through deref, could also allow calls to methods defined on the other interfaces.
The text was updated successfully, but these errors were encountered:
Another point to consider: Versioned interfaces such as ILauncherOptions2 and ILauncherOptions3 are added in newer releases, when only ILauncherOption exists originally. This means that a newer SDK will know these interfaces while an older SDK doesn't. When we check in the generated code as part of the crate, we always build with the SDK that is installed on the build machine, not the one that is installed on the user machine. So there might be interfaces in the generated code that do not yet exist on the OS of the user of the crate. In such cases, QueryInterface will return an error and we must not wrap it in such a way that these kinds of errors get lost.
Many classes implement other interfaces besides their main interface. For example,
Windows.System.LauncherOptions
implementsILauncherOptions
, but alsoILauncherViewOptions
,ILauncherOptions2
andILauncherOptions3
.QueryInterface
can be used to get implementations of these other interfaces, but can generally query arbitrary interfaces and might fail if the interface is not actually available, therefore it returnsResult<>
. We should add a way to query those interfaces that are known to be valid (from the metadata), which can then be returned directly.Maybe this could make use of Rust's conversion traits. Ideally it could work automatically, so that an instance of
ComPtr<LauncherOptions>
, which allows calls to methods defined onILauncherOptions
through deref, could also allow calls to methods defined on the other interfaces.The text was updated successfully, but these errors were encountered: