Module project

Module project 

Source
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.
BootstrappedProject
A fully bootstrapped project with all components initialized and ready to run.
Bootstrapper
The main struct for bootstrapping the project.
ProjectContext
Shared context and configs for all apps. Used in conjunction with the Project trait.
RootHandler
A built root handler that contains both the main request handler and error handler.
RootHandlerBuilder
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.
WithApps
Third phase of bootstrapping a Cot project, the with-apps phase.
WithConfig
Second phase of bootstrapping a Cot project, the with-config phase.
WithDatabase
Fourth phase of bootstrapping a Cot project, the with-database phase.

Traits§

App
A building block for a Cot project.
BootstrapPhase
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§

AuthBackendContext
An alias for ProjectContext in appropriate phase for use with the Project::auth_backend method.
MiddlewareContext
An alias for ProjectContext in appropriate phase for use with the Project::middlewares method.
RegisterAppsContext
An alias for ProjectContext in appropriate phase for use with the Project::register_apps method.
WrappedMiddleware
A type alias for the service type returned by the RootHandlerBuilder::middleware and similar methods.