Attribute Macro com_impl::com_impl

source ·
#[com_impl]
Expand description

#[com_impl]

Generates a VTable for the functions implemented in the impl block this attribute is applied to.

For the general syntax see the example in the crate root.

Additional parameters

#[com_impl(no_parent)]

Specifies that the vtable being implemented here does not have a parent member. These are very rare, but include IUnknown.

Attributes on methods

#[com_name = "..."]

Overrides the method name this function corresponds to in the VTable. Method names by default are mapped from snake_case to PascalCase to determine their winapi names.

#[panic(abort)]

Specifies that in the stub function, code should be generated to catch any unwinding from the user-provided bodies and abort on panic.

#[panic(result = "EXPRESSION")]

Specifies that in the stub functions code should be generated to catch any unwinding from the user-provided bodies and return the specified expression. The expression should have the same type as the standard function body return. This is most useful with functions that return an HRESULT.