Closed
Description
I’d like to write generic code that accepts any type that implements the IUnknown
interface (in order to call Release()
in Drop
). I started with T: Deref<Target=IUnknown>
, but then some winapi types only deference indirectly to IUnknown
.
What do you think of implementing the AsRef
trait (in addition to Deref
) to represent the "implements a COM interface" relationship? For example IDXGIDevice
would have both AsRef<IDXGIObject>
and AsRef<IUnknown>
(in addition to Deref<Target=IDXGIObject>
that it already has). (The body of all these impls could be just self
, since auto-deref is recursive.)
Metadata
Metadata
Assignees
Labels
No labels