Skip to main content

with_scratch

Function with_scratch 

Source
pub fn with_scratch<R>(size: usize, f: impl FnMut(&mut [u8]) -> R) -> R
Expand description

Calls f with a zeroed block of size bytes.

The block comes from the stack where it is small enough, and from the heap otherwise. Sizes are bucketed so that a small request does not pay to zero a block sized for the largest one.