Crate com

Source
Expand description

A helper crate for consuming and producing COM interfaces.

§Example

To work with a COM interface it must first be declared:

/// Define an IAnimal interface
com::interfaces! {
    #[uuid("EFF8970E-C50F-45E0-9284-291CE5A6F771")]
    pub unsafe interface IAnimal: com::interfaces::IUnknown {
        unsafe fn Eat(&self) -> com::sys::HRESULT;
    }
}

To define a COM implementation class:

com::class! {
    pub class BritishShortHairCat: IAnimal {
        num_owners: u32,
    }

    impl IAnimal for BritishShortHairCat {
        fn Eat(&self) -> com::sys::HRESULT {
            println!("Eating...");
            com::sys::NOERROR
        }
    }
}

See the examples directory in the repository for more examples.

Modules§

interfaces
Common COM interfaces including IUknown and IClassFactory
production
Functionality for producing COM classes
runtime
COM runtime facilities
sys
Types for interacting with COM related system APIs

Macros§

class
Declare COM implementation classes
inproc_dll_module
A macro for declaring a COM server to the COM runtime
interfaces
Declare COM interfaces

Enums§

Param
A COM method parameter used to accept either a reference or value.

Traits§

AbiTransferable
Types that are safe to transfer over a COM API boundary.
Interface
A COM compliant interface pointer

Type Aliases§

CLSID
A class ID
IID
An interface ID