server
ModuleThe HTTP/1.1 server on hyper: serves an application on a TCP socket.
It caps the requests in flight server-wide (503 past the cap), drains
in-flight requests on shutdown up to a deadline, disables Nagle, leaves
compression to the application, sends header names in Title-Case, and
gives each request a fresh context whose parent is the application's
static resources.
Contents
use utopia_http::App;pub struct App(/// The application. pub Arc<Http>)use utopia_http::ServerOptions;pub struct ServerOptionsServer tuning for serve.
Default, From.use utopia_http::Settings;pub struct SettingsThe server settings of a Mode, with the CPU count limited by the
cgroup quota. ServerOptions can be built from them.
use utopia_http::Mode;pub enum ModeThe two server shapes: many single-request workers, or a few concurrent ones.
use utopia_http::Handler;pub trait Handler: Send + Sync + 'staticWhat the server runs for each request: turns a request into a response.
use utopia_http::serve;pub async fn serve<H, S>(addr: SocketAddr, handler: Arc<H>, options: ServerOptions, shutdown: S) -> std::io::Result<()> where H: Handler, S: Future<Output = ()> + Send,Serves handler on addr until shutdown resolves.
use utopia_http::serve_listener;pub async fn serve_listener<H, S>(listener: TcpListener, handler: Arc<H>, options: ServerOptions, shutdown: S) -> std::io::Result<()> where H: Handler, S: Future<Output = ()> + Send,Serves handler on a bound listener until shutdown resolves.