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.

Required Associated Types§

source

type Target

The interface type pointed to by this smart pointer.

Required Methods§

source

fn ptr(&self) -> *mut Self::Target

Gets the raw pointer held by this smart pointer.

Implementors§

source§

impl<'a, I: Interface> SmartPtr for ComRef<'a, I>

§

type Target = I

source§

impl<I: Interface> SmartPtr for ComPtr<I>

§

type Target = I