While implementing a Base64-decoding implementation of AsyncRead
(does this already exist, BTW?) I realized I don't know whether the ReadBuf
passed to poll_read()
can ever be full. In other words, is this assertion safe:
fn poll_read(
self: Pin<&mut Self>,
cx: &mut Context<'_>,
rd_buf: &mut tokio::io::ReadBuf<'_>,
) -> Poll<std::io::Result<()>> {
// I think this is impossible, although I couldn't find docs.
assert!(rd_buf.remaining() > 0);
// ....
}
It feels like tokio would never pass a full ReadBuf
, because what would be the point? I just want to be sure.