Struct dxgcap::UniqueCOMPtr [] [src]

pub struct UniqueCOMPtr<T: COMInterface> {
    // some fields omitted
}

A unique pointer to a COM object. Handles refcounting.

Similar to windows CComQIPtr

Methods

impl<T: COMInterface> UniqueCOMPtr<T>

unsafe fn new(ptr: *mut T) -> UniqueCOMPtr<T>

Construct a new unique COM pointer from a pointer to a COM interface. It is the users responsibility to guarantee that no copies of the pointer exists beforehand

fn query_interface<U>(self) -> Result<UniqueCOMPtr<U>, HRESULT> where U: COMInterface + QueryIID

Convert target interface by retrieving pointer to a supported interface of the object.

Examples

let output = {
    let mut output_ptr = ptr::null_mut();
    adapter.EnumOutputs(0, &mut output_ptr);
    UniqueCOMPtr::new(output)
};
let output1 = output.query_interface::<IDXGIOutput1>();

Trait Implementations

impl<T: COMInterface> Deref for UniqueCOMPtr<T>

type Target = T

fn deref(&self) -> &T

impl<T: COMInterface> DerefMut for UniqueCOMPtr<T>

fn deref_mut(&mut self) -> &mut T

impl<T: COMInterface> Drop for UniqueCOMPtr<T>

fn drop(&mut self)

impl<T: COMInterface> Send for UniqueCOMPtr<T>