Function nix_compat::wire::bytes::reader::with_limited

source ·
fn with_limited<R>(
    buf: &mut ReadBuf<'_>,
    n: u64,
    f: impl FnOnce(&mut ReadBuf<'_>) -> R
) -> R
Expand description

Make a limited version of buf, consisting only of up to n bytes of the unfilled section, and call f with it. After f returns, we propagate the filled cursor advancement back to buf.