Struct warp::Server

source ·
pub struct Server<S> { /* private fields */ }
Expand description

A Warp Server ready to filter requests.

Implementations

Run this Server forever on the current thread.

Run this Server forever on the current thread with a specific stream of incoming connections.

This can be used for Unix Domain Sockets, or TLS, etc.

Bind to a socket address, returning a Future that can be executed on any runtime.

Bind to a possibly ephemeral socket address.

Returns the bound address and a Future that can be executed on any runtime.

Create a server with graceful shutdown signal.

When the signal completes, the server will start the graceful shutdown process.

Returns the bound address and a Future that can be executed on any runtime.

Example
extern crate futures;
extern crate warp;

use futures::sync::oneshot;
use warp::Filter;

let routes = warp::any()
    .map(|| "Hello, World!");

let (tx, rx) = oneshot::channel();

let (addr, server) = warp::serve(routes)
    .bind_with_graceful_shutdown(([127, 0, 0, 1], 3030), rx);

// Spawn the server into a runtime
warp::spawn(server);

// Later, start the shutdown...
let _ = tx.send(());

Setup this Server with a specific stream of incoming connections.

This can be used for Unix Domain Sockets, or TLS, etc.

Returns a Future that can be executed on any runtime.

Trait Implementations

Formats the value using the given formatter. Read more

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.

Should always be Self
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.