pub struct ComWrapper<C: Class> { /* private fields */ }
Expand description

A wrapper for constructing a reference-counted COM object from a Rust value.

ComWrapper represents an owning reference to the COM object, i.e. it will decrement the object’s reference count when it goes out of scope.

Implementations§

source§

impl<C: Class> ComWrapper<C>

source

pub fn new(data: C) -> ComWrapper<C>
where C: 'static, C::Interfaces: MakeHeader<C, Self>,

Allocates memory for an object and its header and places data into it.

source

pub fn as_com_ref<'a, I: Interface>(&'a self) -> Option<ComRef<'a, I>>

If I is in C’s interface list, returns a ComRef<I> pointing to the object.

Does not perform any reference counting operations.

source

pub fn to_com_ptr<I: Interface>(&self) -> Option<ComPtr<I>>

If I is in C’s interface list, returns a ComPtr<I> pointing to the object.

If a ComPtr is returned, the object’s reference count will be incremented.

Trait Implementations§

source§

impl<C: Class> Clone for ComWrapper<C>

source§

fn clone(&self) -> ComWrapper<C>

Returns a copy of the value. Read more
1.0.0 · source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
source§

impl<C: Class> Deref for ComWrapper<C>

§

type Target = C

The resulting type after dereferencing.
source§

fn deref(&self) -> &Self::Target

Dereferences the value.
source§

impl<C: Class> Wrapper<C> for ComWrapper<C>

source§

unsafe fn data_from_header(ptr: *mut Header<C>) -> *mut C

Given a pointer to an object’s header, returns a pointer to the object itself.
source§

unsafe fn header_from_data(ptr: *mut C) -> *mut Header<C>

Given a pointer to an object, returns a pointer to the object’s header.
source§

unsafe fn add_ref(ptr: *mut C) -> usize

Increments the reference count of an object and returns the resulting count.
source§

unsafe fn release(ptr: *mut C) -> usize

Decrements the reference count of an object and returns the resulting count.
source§

impl<C> Send for ComWrapper<C>
where C: Send + Sync + Class,

source§

impl<C> Sync for ComWrapper<C>
where C: Send + Sync + Class,

Auto Trait Implementations§

Blanket Implementations§

source§

impl<T> Any for T
where T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for T
where T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

source§

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

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T, U> Into<U> for T
where U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

source§

impl<T> ToOwned for T
where T: Clone,

§

type Owned = T

The resulting type after obtaining ownership.
source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

§

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

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.