Skip to main content

Interface

Trait Interface 

Source
pub unsafe trait Interface: Sized + 'static {
    type Vtbl: 'static;

    const IID: Guid;
    const NAME: &'static str;

    // Required method
    fn matches_iid(iid: &Guid) -> bool;

    // Provided methods
    fn as_unknown(&self) -> &IUnknown { ... }
    fn as_raw(&self) -> *mut Self { ... }
}
Expand description

Implemented (by generated code) for every COM interface type.

§Safety

Self must be #[repr(C)] with a single field: a pointer to Self::Vtbl, and Self::Vtbl must start with the vtable of the base interface (ultimately IUnknownVtbl).

Required Associated Constants§

Source

const IID: Guid

The interface’s IID as written in the IDL.

Source

const NAME: &'static str

IDL name, for diagnostics.

Required Associated Types§

Source

type Vtbl: 'static

Required Methods§

Source

fn matches_iid(iid: &Guid) -> bool

true if iid names this interface or one of its bases (including IUnknown). Both the IDL value and the value materialized by com.h (see Guid::as_com_h_materialized) are accepted.

Provided Methods§

Source

fn as_unknown(&self) -> &IUnknown

Source

fn as_raw(&self) -> *mut Self

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§

Source§

impl Interface for IUnknown

Source§

const IID: Guid

Source§

const NAME: &'static str = "IUnknown"

Source§

type Vtbl = IUnknownVtbl