Struct breadboard::Breadboard

source ·
pub struct Breadboard { /* private fields */ }
Expand description

A router builder.

Register your routes, then use hyper’s NewService trait to create the service.

See the crate-level documentation for examples.

Anatomy of a handler

A handler is a function that takes a single argument, Request<T>. T must implement serde::Deserialize.

The handler returns a type that implements IntoFuture. The future’s Item is a Response<T>, where T must implement serde::Serialize. The future’s Error can be anything that implements std::error::Error, Send, and Sync.

If you aren’t doing any work in your handler that requires use of futures, you can simply return a Result, as Result implements IntoFuture.

Implementations§

Start a new Breadboard.

Add a handler for a route with the given method.

Add a handler for GET requests for a route.

Add a handler for POST requests for a route.

Add a handler for PUT requests for a route.

Add a handler for DELETE requests for a route.

Add a handler for HEAD requests for a route.

Add a handler for OPTIONS requests for a route.

Add a handler for CONNECT requests for a route.

Add a handler for PATCH requests for a route.

Add a handler for TRACE requests for a route.

fixme

Trait Implementations§

Formats the value using the given formatter. Read more
Returns the “default value” for a type. Read more
The Payload body of the http::Request.
The Payload body of the http::Response.
The error type that can be returned by Services.
The resolved Service from new_service().
The future returned from new_service of a Service.
The error type that can be returned when creating a new Service.
Create a new Service.

Auto Trait Implementations§

Blanket Implementations§

Gets the TypeId of self. Read more
Immutably borrows from an owned value. Read more
Mutably borrows from an owned value. Read more

Returns the argument unchanged.

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

The Payload body of the http::Request.
The Payload body of the http::Response.
The error type that can be returned by Services.
The resolved Service from new_service().
The future returned from new_service of a Service.
The error type that can be returned when creating a new Service.
Returns Ready when the constructor is ready to create a new Service. Read more
Create a new Service.
The type returned in the event of a conversion error.
Performs the conversion.
The type returned in the event of a conversion error.
Performs the conversion.