fn read_exact<'a>(&'a mut self, buf: &'a mut [u8]) -> ReadExact<'a, Self>
    where
        Self: Unpin,
    {
        assert_future::<Result<()>, _>(ReadExact::new(self, buf))
    }
Creates a future which will read exactly enough bytes to fill `buf`,
returning an error if end of file (EOF) is hit sooner.

The returned future will resolve once the read operation is completed.

In the case of an error the buffer and the object will be discarded, with
the error yielded.

# Examples

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

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

reader.read_exact(&mut output).await?;

assert_eq!(output, [1, 2, 3, 4]);
# Ok::<(), Box<dyn std::error::Error>>(()) }).unwrap();
```

## EOF is hit before `buf` is filled

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

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

let result = reader.read_exact(&mut output).await;

assert_eq!(result.unwrap_err().kind(), io::ErrorKind::UnexpectedEof);
# });
```
futures-util/src/io/mod.rs