Function discard
pub async fn discard<R>(reader: &mut R, n: u64) -> Result<(), Error>where
R: AsyncRead + Unpin,Expand description
Read and discard exactly n bytes from reader.
Equivalent to reader.read_exact(&mut vec![0u8; n]) but does not allocate
a buffer sized to n; it pipes the bytes through [tokio::io::sink] via
a take adaptor, reusing a small internal scratch buffer instead.
Returns an UnexpectedEof error if the reader yields fewer than n bytes
before EOF.