Struct vst3::ComWrapper

source ·
pub struct ComWrapper<C>
where 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> ComWrapper<C>
where C: Class,

source

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

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

source

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

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>(&self) -> Option<ComPtr<I>>
where I: Interface,

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> Clone for ComWrapper<C>
where C: Class,

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> Deref for ComWrapper<C>
where C: Class,

§

type Target = C

The resulting type after dereferencing.
source§

fn deref(&self) -> &<ComWrapper<C> as Deref>::Target

Dereferences the value.
source§

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

source§

unsafe fn data_from_header( ptr: *mut <<C as Class>::Interfaces as InterfaceList>::Header ) -> *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 <<C as Class>::Interfaces as InterfaceList>::Header

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: Class + Send + Sync,

source§

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

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.