bolt-web 0.1.7

⚡ A high-performance, minimalist web framework for Rust, inspired by Express.js and Gin.
Documentation
use crate::{request::RequestBody, response::ResponseWriter};
use async_trait::async_trait;

#[derive(Hash, Eq, PartialEq, Debug, Clone, Copy)]
pub enum Method {
    GET,
    POST,
    PUT,
    PATCH,
    DELETE,
    OPTIONS,
    HEAD,
    TRACE,
}

#[derive(Eq, PartialEq)]
#[allow(dead_code)]
pub enum Mode {
    Http1,
    Http2,
}

#[async_trait]
pub trait Middleware: Send + Sync {
    async fn run(&self, req: &mut RequestBody, res: &mut ResponseWriter);
}

#[async_trait]
pub trait ErrorHandler: Send + Sync {
    async fn run(&self, msg: String, res: &mut ResponseWriter);
}

#[async_trait]
pub trait Handler: Send + Sync {
    async fn handle(&self, req: &mut RequestBody, res: &mut ResponseWriter);
}