Trait Controller

Source
pub trait Controller {
    const BASE_PATH: &'static str;

    // Required method
    fn handlers(&self) -> Vec<ControllerEndpoint<Self>> 
       where Self: Sized;
}
Expand description

Trait that defines how a controller handles its requests

Required Associated Constants§

Source

const BASE_PATH: &'static str

Defines the base path from which requests are to be handled by this controller

Required Methods§

Source

fn handlers(&self) -> Vec<ControllerEndpoint<Self>>
where Self: Sized,

Returns a list of ControllerEndpoint

Each ControllerEndpoint is then added to the router, which will dispatch requests accordingly

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§