pub trait BootstrapPhase: Sealed {
type RequestHandler: Debug;
type ErrorHandler: Debug;
type Config: Debug;
type Apps;
type Router: Debug;
type Database: Debug;
type AuthBackend;
}Expand description
A trait that represents the different phases of the bootstrapper.
This trait is used to define the types for the different phases of the bootstrapper. It’s used to ensure that you can’t access nonexistent data until the bootstrapper has reached the corresponding phase.
§Order of phases
§Sealed
This trait is sealed and can’t be implemented outside the cot
crate.
§Examples
use cot::project::{MiddlewareContext, RegisterAppsContext, RootHandler, RootHandlerBuilder};
use cot::{AppBuilder, Project};
struct MyProject;
impl Project for MyProject {
// `WithConfig` phase here
fn register_apps(&self, apps: &mut AppBuilder, context: &RegisterAppsContext) {
unimplemented!();
}
// `WithDatabase` phase here (which comes after `WithConfig`)
fn middlewares(
&self,
handler: RootHandlerBuilder,
context: &MiddlewareContext,
) -> RootHandler {
unimplemented!()
}
}Required Associated Types§
Sourcetype RequestHandler: Debug
type RequestHandler: Debug
The type of the request handler.
Sourcetype ErrorHandler: Debug
type ErrorHandler: Debug
The type of the error handler.
Sourcetype AuthBackend
type AuthBackend
The type of the auth backend.