Function read_until_limited

Source
pub(crate) async fn read_until_limited<S>(
    stream: &mut S,
    byte: u8,
    max: usize,
    buf: &mut Vec<u8>,
) -> Result<usize>
where S: AsyncBufRead + Unpin,
Expand description

As AsyncBufReadExt::read_until, but stops after reading max bytes.

Note that this function might not actually read any byte of value byte, since EOF might occur, or we might fill the buffer.

A return value of 0 indicates an end-of-file.