The
#[interface]macro for declaring COM interfaces in Rust.
- 馃摝 crates.io
- 馃摉 docs.rs
- 馃殌 Getting started
- 馃搧 Source
windows-interface provides the #[interface] attribute macro used to declare a COM interface as a
Rust trait. It is part of windows-core and exists as a separate crate only
because Rust requires procedural macros to ship in their own proc-macro crate. windows-core
re-exports it behind the default proc-macros feature, so you depend on windows-core and rarely
name this crate directly. The generated code refers to windows-core for IUnknown, the vtable
layout, and QueryInterface support.
See windows-core for how to declare an interface and pair it with
#[implement] - including a worked example and the interface_decl!
declarative alternative for builds without the proc macros.
The remainder of this page covers how the crate is built and maintained. It is for contributors and
is not needed to use windows-interface.
A proc-macro crate. The crate-level docs in src/lib.rs cover what the macro generates (the
interface struct, *_Vtbl, and *_Impl trait) and how it must agree with #[implement]. Uses
syn/quote/proc-macro2.
Run cargo test -p windows-interface; see also the workspace test crates.