logo
Expand description

A selection of re-exports from actix-rt and tokio.

Running Actix Web Macro-less

use actix_web::{middleware, rt, web, App, HttpRequest, HttpServer};

async fn index(req: HttpRequest) -> &'static str {
    println!("REQ: {:?}", req);
    "Hello world!\r\n"
}

rt::System::new().block_on(
    HttpServer::new(|| {
        App::new()
            .wrap(middleware::Logger::default())
            .service(web::resource("/").route(web::get().to(index)))
    })
    .bind(("127.0.0.1", 8080))?
    .workers(1)
    .run()
)

Modules

TCP/UDP/Unix bindings (mostly Tokio re-exports).

Asynchronous signal handling (Tokio re-exports).

Task management (Tokio re-exports).

Utilities for tracking time (Tokio re-exports).

Macros

Pins a value on the stack.

Structs

A Tokio-based runtime proxy.

A manager for a per-thread distributed async runtime.

Runner that keeps a System’s event loop alive until stop message is received.

Functions

Spawns a future on the current thread as a new task.