Attribute Macro windows_core::interface

#[interface]
Expand description

Defines a COM interface to call or implement.

§Example

#[interface("094d70d6-5202-44b8-abb8-43860da5aca2")]
unsafe trait IValue: IUnknown {
    fn GetValue(&self, value: *mut i32) -> HRESULT;
}

#[implement(IValue)]
struct Value(i32);

impl IValue_Impl for Value {
    unsafe fn GetValue(&self, value: *mut i32) -> HRESULT {
        *value = self.0;
        HRESULT(0)
    }
}

fn main() {
    let object: IValue = Value(123).into();
    // Call interface methods...
}