[−][src]Struct com::ComRc
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]
fn clone(&self) -> Self[src]
fn clone_from(&mut self, source: &Self)1.0.0[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]
unsafe fn create_instance(
&self,
aggr: *mut IUnknownVPtr,
riid: *const GUID,
ppv: *mut *mut c_void
) -> HRESULT[src]
&self,
aggr: *mut IUnknownVPtr,
riid: *const GUID,
ppv: *mut *mut c_void
) -> HRESULT
unsafe fn lock_server(&self, increment: BOOL) -> HRESULT[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,
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,
T: Unpin,
impl<T: ?Sized> UnwindSafe for ComRc<T> where
T: UnwindSafe,
<T as ComInterface>::VTable: RefUnwindSafe,
T: UnwindSafe,
<T as ComInterface>::VTable: RefUnwindSafe,
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized, [src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized, [src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized, [src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T[src]
impl<T> From<T> for T[src]
impl<T, U> Into<U> for T where
U: From<T>, [src]
U: From<T>,
impl<T> ToOwned for T where
T: Clone, [src]
T: Clone,
type Owned = T
The resulting type after obtaining ownership.
fn to_owned(&self) -> T[src]
fn clone_into(&self, target: &mut T)[src]
impl<T, U> TryFrom<U> for T where
U: Into<T>, [src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>, [src]
U: TryFrom<T>,