Following this advice from the compiler makes it compile just fine for me.
I would even clean it up a bit like this:
use futures::{ stream::Stream, ready };
use core::pin::Pin;
use core::task::{ Context, Poll };
pub struct ByteStream<R>(R);
impl <R: tokio::io::AsyncRead + Unpin> Stream for ByteStream<R>
{
type Item = u8;
fn poll_next(mut self : Pin<&mut Self>, cx: &mut Context) -> Poll<Option<Self::Item>>
{
let mut buf = [0;1];
match ready!( Pin::new(&mut self.0).poll_read(cx, &mut buf) )
{
Ok(n) if n != 0 => Some(buf[0]).into() ,
_ => None .into() ,
}
}
}