Struct ComBox

Source
pub struct ComBox<T: ComClass> { /* private fields */ }
Expand description

Pointer to a COM-enabled Rust struct.

Intercom requires a specific memory layout for the COM objects so that it can implement reference counting and map COM method calls back to the target struct instance.

This is done by requiring each COM-enabled Rust object is constructed through a ComBox<T> type.

Technically the memory layout is specified by the ComBoxData type, however that type shouldn’t be needed by the user. For all intents the ComBox type is the COM-compatible object handle.

Implementations§

Source§

impl<T: ComClass> ComBox<T>

Source

pub fn new(value: T) -> ComBox<T>

Constructs a new ComBox by placing the value into reference counted memory.

  • value - The initial state to use for the COM object.

Trait Implementations§

Source§

impl<T: ComClass> AsMut<ComBoxData<T>> for ComBox<T>

Source§

fn as_mut(&mut self) -> &mut ComBoxData<T>

Converts this type into a mutable reference of the (usually inferred) input type.
Source§

impl<T: ComClass> AsRef<ComBoxData<T>> for ComBox<T>

Source§

fn as_ref(&self) -> &ComBoxData<T>

Converts this type into a shared reference of the (usually inferred) input type.
Source§

impl<T: ComClass + Debug> Debug for ComBox<T>

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl<T: Default + ComClass> Default for ComBox<T>

Source§

fn default() -> Self

Returns the “default value” for a type. Read more
Source§

impl<T> Deref for ComBox<T>
where T: ComClass,

Source§

type Target = T

The resulting type after dereferencing.
Source§

fn deref(&self) -> &T

Dereferences the value.
Source§

impl<T> DerefMut for ComBox<T>
where T: ComClass,

Source§

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

Mutably dereferences the value.
Source§

impl<T: ComClass> Drop for ComBox<T>

Source§

fn drop(&mut self)

Decreases the reference count by one. If this is the last reference the memory will be deallocated.

Source§

impl<I: ComInterface + ?Sized, T: HasInterface<I>> From<&ComBox<T>> for ComRc<I>

Source§

fn from(combox: &ComBox<T>) -> Self

Converts to this type from the input type.
Source§

impl<I: ComInterface + ?Sized, T: HasInterface<I>> From<ComBox<T>> for ComRc<I>

Source§

fn from(source: ComBox<T>) -> ComRc<I>

Converts to this type from the input type.
Source§

impl<T: HasInterface<dyn IUnknown>> From<ComBox<T>> for Variant

Source§

fn from(src: ComBox<T>) -> Self

Converts to this type from the input type.

Auto Trait Implementations§

§

impl<T> Freeze for ComBox<T>

§

impl<T> RefUnwindSafe for ComBox<T>

§

impl<T> !Send for ComBox<T>

§

impl<T> !Sync for ComBox<T>

§

impl<T> Unpin for ComBox<T>

§

impl<T> UnwindSafe for ComBox<T>

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> ExternDefault for T

Source§

unsafe fn extern_default() -> T

Safety 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<P, T> Receiver for P
where P: Deref<Target = T> + ?Sized, T: ?Sized,

Source§

type Target = T

🔬This is a nightly-only experimental API. (arbitrary_self_types)
The target type on which the method may be called.
Source§

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

Source§

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>,

Source§

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.