[−][src]Struct winrt::ComPtr
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]
Interface: ComInterface,
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]
T: RtClassInterface,
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]
Target: ComIid,
T: ComInterface,
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(&self) -> Self
[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]
fn eq(&self, other: &ComPtr<T>) -> bool
[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]
&'a T: IntoIterator,
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?
fn into_iter(self) -> Self::IntoIter
[src]
impl<T> Deref for ComPtr<T>
[src]
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
Blanket Implementations
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> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T> From<T> for 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>,
type Error = <U as TryFrom<T>>::Error
The type returned in the event of a conversion error.
fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>
[src]
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> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,