Expand description
This module contains the core types and traits for a Cot project.
This module defines the Project and App traits, which are the main
entry points for your application.
§Examples
use cot::Project;
use cot::cli::CliMetadata;
struct MyProject;
impl Project for MyProject {
fn cli_metadata(&self) -> CliMetadata {
cot::cli::metadata!()
}
}
#[cot::main]
fn main() -> impl Project {
MyProject
}Structs§
- AppBuilder
- A helper struct to build the apps for the project.
- Bootstrapped
Project - A fully bootstrapped project with all components initialized and ready to run.
- Bootstrapper
- The main struct for bootstrapping the project.
- Project
Context - Shared context and configs for all apps. Used in conjunction with the
Projecttrait. - Root
Handler - A built root handler that contains both the main request handler and error handler.
- Root
Handler Builder - A helper struct to build the root handler for the project.
Enums§
- Initialized
- The final phase of bootstrapping a Cot project, the initialized phase.
- Uninitialized
- First phase of bootstrapping a Cot project, the uninitialized phase.
- With
Apps - Third phase of bootstrapping a Cot project, the with-apps phase.
- With
Config - Second phase of bootstrapping a Cot project, the with-config phase.
- With
Database - Fourth phase of bootstrapping a Cot project, the with-database phase.
Traits§
- App
- A building block for a Cot project.
- Bootstrap
Phase - A trait that represents the different phases of the bootstrapper.
- Project
- The main trait for a Cot project.
Functions§
- run
- Runs the Cot project on the given address.
- run_at
- Runs the Cot project on the given listener.
- run_
at_ with_ shutdown - Runs the Cot project on the given listener.
- run_cli
- Runs the CLI for the given project.
Type Aliases§
- Auth
Backend Context - An alias for
ProjectContextin appropriate phase for use with theProject::auth_backendmethod. - Middleware
Context - An alias for
ProjectContextin appropriate phase for use with theProject::middlewaresmethod. - Register
Apps Context - An alias for
ProjectContextin appropriate phase for use with theProject::register_appsmethod. - Wrapped
Middleware - A type alias for the service type returned by the
RootHandlerBuilder::middlewareand similar methods.