Crate com[][src]

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

Common COM interfaces including IUknown and IClassFactory

Functionality for producing COM classes

COM runtime facilities

Types for interacting with COM related system APIs

Macros

Declare COM implementation classes

A macro for declaring a COM server to the COM runtime

Declare COM interfaces

Enums

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

Traits

Types that are safe to transfer over a COM API boundary.

A COM compliant interface pointer

Type Definitions

A class ID

An interface ID