INNER CODE UNIT · Rust
new
TheWaWaR/simple-http-server · src/handlers.rs:136
fn new(receiver: mpsc::Receiver<io::Result<Bytes>>, exact_len: Option<u64>) -> Self {
Self {
receiver,
exact_len,
}
}
}
impl http_body::Body for ChannelBody {
type Data = Bytes;
type Error = io::Error;
fn poll_frame(
self: Pin<&mut Self>,
cx: &mut Context<'_>,
) -> Poll<Option<Result<Frame<Self::Data>, Self::Error>>> {
let this = self.get_mut();
match Pin::new(&mut this.receiver).poll_recv(cx) {