[][src]Struct winrt::ComPtr

#[repr(transparent)]
pub struct ComPtr<T>(_);

Smart pointer for Windows Runtime objects. This pointer automatically maintains the reference count of the underlying COM object.

Methods

impl<T> ComPtr<T>[src]

pub unsafe fn wrap(ptr: *mut T) -> ComPtr<T>[src]

Creates a ComPtr to wrap a raw pointer. It takes ownership over the pointer which means it does not call AddRef. T must be a COM interface that inherits from IUnknown. The wrapped pointer must not be null.

pub unsafe fn wrap_optional(ptr: *mut T) -> Option<ComPtr<T>>[src]

Creates an optional ComPtr to wrap a raw pointer that may be null. It takes ownership over the pointer which means it does not call AddRef. T must be a COM interface that inherits from IUnknown.

pub unsafe fn into_unchecked<Interface>(self) -> ComPtr<Interface> where
    Interface: ComInterface
[src]

Changes the type of the underlying COM object to a different interface without doing QueryInterface. This is a runtime no-op, but you need to be sure that the interface is compatible.

pub fn get_runtime_class_name(&self) -> HString where
    T: RtClassInterface
[src]

Gets the fully qualified name of the current Windows Runtime object. This is only available for interfaces that inherit from IInspectable and are not factory or statics interfaces.

Examples

Basic usage:

use winrt::*;
use winrt::windows::foundation::Uri;

let uri = FastHString::new("https://www.rust-lang.org");
let uri = Uri::create_uri(&uri).unwrap();
assert_eq!("Windows.Foundation.Uri", uri.get_runtime_class_name().to_string());

pub fn query_interface<Target>(&self) -> Option<ComPtr<Target>> where
    Target: ComIid,
    T: ComInterface
[src]

Retrieves a ComPtr to the specified interface, if it is supported by the underlying object. If the requested interface is not supported, None is returned.

Trait Implementations

impl<T> Clone for ComPtr<T>[src]

fn clone_from(&mut self, source: &Self)1.0.0[src]

Performs copy-assignment from source. Read more

impl<T> PartialEq<ComPtr<T>> for ComPtr<T>[src]

#[must_use]
fn ne(&self, other: &Rhs) -> bool
1.0.0[src]

This method tests for !=.

impl<T> Drop for ComPtr<T>[src]

impl<'a, T> IntoIterator for &'a ComPtr<T> where
    &'a T: IntoIterator
[src]

type Item = <&'a T as IntoIterator>::Item

The type of the elements being iterated over.

type IntoIter = <&'a T as IntoIterator>::IntoIter

Which kind of iterator are we turning this into?

impl<T> Deref for ComPtr<T>[src]

type Target = T

The resulting type after dereferencing.

impl<T> DerefMut for ComPtr<T>[src]

impl<T: Debug> Debug for ComPtr<T>[src]

impl<T> Pointer for ComPtr<T>[src]

Auto Trait Implementations

impl<T> !Send for ComPtr<T>

impl<T> !Sync for ComPtr<T>

Blanket Implementations

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

type Owned = T

The resulting type after obtaining ownership.

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

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

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.

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

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

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