Function actix_web_lab::body::writer

source ·
pub fn writer() -> (Writer, impl MessageBody)
Expand description

Returns an AsyncWrite response body writer and its associated body type.

Examples

use tokio::io::AsyncWriteExt as _;
use actix_web_lab::body;

let (mut wrt, body) = body::writer();

let _ = tokio::spawn(async move {
    wrt.write_all(b"body from another thread").await
});

HttpResponse::Ok().body(body)