Skip to main content

peek_input_until_verdict

Function peek_input_until_verdict 

pub async fn peek_input_until_verdict<R, O, P>(
    reader: &mut R,
    buffer: &mut [u8],
    offset: usize,
    waiter: &mut PeekWaiter<'_>,
    predicate: P,
) -> PeekOutput<O>
where R: AsyncRead + Unpin, P: Fn(&[u8]) -> PeekVerdict<O>,
Available on crate feature std only.
Expand description

Read into the fixed buffer until predicate decides, peeking stops, or the waiter cuts the peek short.

The first offset bytes of buffer are an earlier peek (clamped to its length); the predicate classifies them before reading. Peeking stops when: