Crate zap [] [src]

The zap web framework crate.

Example

Here a short HelloWorld example writte in Rust with zap:

extern crate zap;

use std::io::Error as ZapError;
use zap::prelude::*;

struct HelloWorld;

impl Handler for HelloWorld {
    type Request = Request;
    type Response = Response;
    type Error = ZapError;
    type Future = ZapResult;

    fn call(&self, _ : Request) -> ZapResult {
        let mut resp = Response::new();

        resp.body("Hello World!");

        resp.ok()
    }
}

Modules

prelude

A module to import the required things.

Structs

Http

Handling incoming requests with tokio-proto

HttpCodec

Encode and decode our request

Request

The result of an incoming request

Response

The result of an outgoing request

Server

A builder for TCP servers.

Traits

Handler

An asynchronous function from Request to a Response.

Type Definitions

ZapResult

The expected response result