fn read<'a>(&'a mut self, buf: &'a mut [u8]) -> Read<'a, Self>
    where
        Self: Unpin,
    {
        assert_future::<Result<usize>, _>(Read::new(self, buf))
    }
Tries to read some bytes directly into the given `buf` in asynchronous
manner, returning a future type.

The returned future will resolve to the number of bytes read once the read
operation is completed.

# Examples

```
# futures::executor::block_on(async {
use futures::io::{AsyncReadExt, Cursor};

let mut reader = Cursor::new([1, 2, 3, 4]);
let mut output = [0u8; 5];

let bytes = reader.read(&mut output[..]).await?;

// This is only guaranteed to be 4 because `&[u8]` is a synchronous
// reader. In a real system you could get anywhere from 1 to
// `output.len()` bytes in a single read.
assert_eq!(bytes, 4);
assert_eq!(output, [1, 2, 3, 4, 0]);
# Ok::<(), Box<dyn std::error::Error>>(()) }).unwrap();
```
futures-util/src/io/mod.rs