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 actix_web_lab::body;
use tokio::io::AsyncWriteExt as _;

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

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

HttpResponse::Ok().body(body)