Skip to main content

start_async

Function start_async 

Source
pub async fn start_async(server: Server) -> Result<(), ServerError>
Available on crate feature async only.
Expand description

Starts an async accept loop backed by Tokio.

Each accepted connection is converted to a standard stream and served via the existing synchronous connection handler on Tokio’s blocking pool.

§Examples

use http_handle::async_server::start_async;
use http_handle::Server;
let server = Server::new("127.0.0.1:8080", ".");
let _ = start_async(server).await;

§Errors

Returns an error when binding or accept fails.

§Panics

This function does not panic.