HttpServer

Trait HttpServer 

Source
pub trait HttpServer<Req: Request, Resp: Response> {
    // Required methods
    fn serve(
        &mut self,
        path: &str,
        method: HttpMethod,
        ep: impl Endpoint<Req, Resp>,
    );
    fn serve_dir(&mut self, path: &str, dir: impl AsRef<Path>) -> HttpResult<()>;
    fn serve_file(
        &mut self,
        path: &str,
        file: impl AsRef<Path>,
    ) -> HttpResult<()>;
}

Required Methods§

Source

fn serve( &mut self, path: &str, method: HttpMethod, ep: impl Endpoint<Req, Resp>, )

Source

fn serve_dir(&mut self, path: &str, dir: impl AsRef<Path>) -> HttpResult<()>

Source

fn serve_file(&mut self, path: &str, file: impl AsRef<Path>) -> HttpResult<()>

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§