use futures::{Stream, AsyncRead}; use std::task::{Context, Poll}; use std::pin::Pin; use actix_web::web::Bytes; use std::io::Error; struct ToStream(T); impl Stream for ToStream{ type Item = Result; fn poll_next(self: Pin<&mut Self>, cx: &mut Context<'_>) -> Poll> { let mut buff: [u8; 1024] = [0; 1024]; self.0.poll_read(cx, &mut buff[..]).map_ok(|l| {Bytes::copy_from_slice(&buff[0..l])}) // il manque Option } }