Skip to main content

requires_interface

Attribute Macro requires_interface 

Source
#[requires_interface]
Expand description

Requires an interface test to exist for this implementation.

Place this on impl blocks or structs that must have interface tests. Without the corresponding #[interface_test(Name)] test, this fails to compile.

§Example

// This only compiles if tests/cpu_interface.rs has #[interface_test(CpuMetrics)]
#[requires_interface(CpuMetrics)]
impl CpuMetrics {
    pub fn frequency(&self) -> u64 { ... }
}