Skip to main content

DeclaresExpectation

Trait DeclaresExpectation 

Source
pub trait DeclaresExpectation {
    const EXPECTS: &'static str;
}
Expand description

Implemented by the #[controller] macro for every controller that declares expects = "…"; absent on a controller that declares nothing, which is the whole point. The families { … } block in app_routes! requires this trait of every controller mounted under a listed prefix, so a silently undeclared controller under a covered prefix is a compile error — the on_unimplemented message below is the one the developer reads.

EXPECTS is the same label Controller::actus_expects returns at runtime, lifted to a constant so a family’s accepted set can be checked at compile time too (see declares_expectation_in).

Required Associated Constants§

Source

const EXPECTS: &'static str

The declared floor — the value of #[controller(expects = …)].

Dyn Compatibility§

This trait is not dyn compatible.

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

Implementors§