Skip to main content

with_scratch

Function with_scratch 

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

Run f on a buffer of len bytes which the thread keeps for all reads which copy what they got out of it right away. The read loops of all containers and attach clients and the runtime calls share it, instead of keeping a buffer each while they wait. It grows to the largest len asked for and holds what the last use left in it.