Trait com_scrape_types::SmartPtr
source · pub trait SmartPtr {
type Target;
// Required method
fn ptr(&self) -> *mut Self::Target;
}
Expand description
Trait for types that represent a smart pointer to a COM object.
Implemented by ComPtr
and ComRef
.
The purpose of this trait is to enable blanket implementations of interface traits for all
smart pointers with a compatible target for that interface. For each interface IInterface
,
com-scrape
will generate a blanket implementation of IInterfaceTrait
as follows:
ⓘ
impl<P> IInterfaceTrait for P
where
P: SmartPtr,
P::Target: Inherits<IInterface>,
{
/* ... */
}
This makes it possible to call the methods of IInterface
directly on a ComPtr<IInterface>
,
or on any ComPtr<IOtherInterface>
where IOtherInterface
is derived from from IInterface
.