Skip to main content

peek_input_until_verdict_with_options

Function peek_input_until_verdict_with_options 

pub async fn peek_input_until_verdict_with_options<R, O, P>(
    reader: &mut R,
    buffer: &mut [u8],
    offset: usize,
    timeout: Option<Duration>,
    max_attempts: Option<NonZero<usize>>,
    predicate: P,
) -> PeekOutput<O>
where R: AsyncRead + Unpin, P: Fn(&[u8]) -> PeekVerdict<O>,
Available on crate feature std only.
Expand description

Same as peek_input_until_with_options but with a fail-fast three-way PeekVerdict predicate. This is the core peek loop; the Option-based helpers are thin wrappers that never reject.

In addition to the stop conditions of peek_input_until, peeking also stops immediately when the predicate returns PeekVerdict::Reject, in which case no further read is issued and data is None.