[][src]Struct com::ComRc

pub struct ComRc<T: ComInterface + ?Sized> { /* fields omitted */ }

A reference counted COM interface.

This smart pointer type automatically calls AddRef when cloned and Release when dropped.

This is normally the correct way to interact with an interface. If for some (usually unsafe) reason, you need to interact with an interface without automatically performing AddRef and Release, you can use the ComPtr type.

Methods

impl ComRc<dyn IClassFactory>[src]

pub fn get_instance<T: ComInterface + ?Sized>(&self) -> Option<ComRc<T>>[src]

Get an instance of the associated Co Class

impl<T: ComInterface + ?Sized> ComRc<T>[src]

pub fn new(ptr: ComPtr<T>) -> ComRc<T>[src]

Creates a new ComRc that comforms to the interface T.

pub unsafe fn from_raw(ptr: *mut *mut <T as ComInterface>::VTable) -> Self[src]

Construct an ComRc from a raw pointer to a COM interface.

Safety

The same safety guarantees as ComPtr::new must be upheld by the function.

pub fn as_raw(&self) -> *mut *mut <T as ComInterface>::VTable[src]

Gets the underlying interface ptr. This ptr is only guarnteed to live for as long as the current ComRc is alive.

pub fn get_interface<I: ComInterface + ?Sized>(&self) -> Option<ComRc<I>>[src]

A safe version of QueryInterface. If the backing CoClass implements the interface I then a Some containing an ComRc pointing to that interface will be returned otherwise None will be returned.

Trait Implementations

impl<T: ComInterface + ?Sized> Clone for ComRc<T>[src]

impl<T: ComInterface + ?Sized> Drop for ComRc<T>[src]

impl<T: ComInterface + ?Sized> From<ComRc<T>> for ComPtr<T>[src]

fn from(rc: ComRc<T>) -> Self[src]

Convert from an ComRc to an ComPtr

Note that this does not call the release on the underlying interface which gurantees that the ComPtr will still point to a valid interface. If Release is never called on this pointer, than memory may be leaked.

impl<T: IClassFactory + ComInterface + ?Sized> IClassFactory for ComRc<T>[src]

impl<T: IUnknown + ComInterface + ?Sized> IUnknown for ComRc<T>[src]

Auto Trait Implementations

impl<T: ?Sized> RefUnwindSafe for ComRc<T> where
    T: RefUnwindSafe,
    <T as ComInterface>::VTable: RefUnwindSafe

impl<T> !Send for ComRc<T>

impl<T> !Sync for ComRc<T>

impl<T: ?Sized> Unpin for ComRc<T> where
    T: Unpin

impl<T: ?Sized> UnwindSafe for ComRc<T> where
    T: UnwindSafe,
    <T as ComInterface>::VTable: RefUnwindSafe

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.