Skip to main content

ControllerDefinition

Trait ControllerDefinition 

Source
pub trait ControllerDefinition:
    Send
    + Sync
    + 'static {
    // Required method
    fn router() -> Router<Container>;
}
Expand description

A ControllerDefinition provides the structure for NestForge to build an Axum router.

The #[routes] macro automatically generates implementations of this trait. It handles wiring up handler functions with their required guards, interceptors, and pipes.

Custom routers can implement this trait directly if needed, though the macro approach is typically sufficient for most use cases.

Required Methods§

Source

fn router() -> Router<Container>

Builds the Axum router for this controller, using the framework container for its internal state.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementors§