Skip to main content

chunks

Function chunks 

Source
pub fn chunks(body: &[u8], limit: usize) -> impl Iterator<Item = &[u8]>
Expand description

Splits a body into chunk bodies exactly as Tern’s tsp_chunks does.

Each piece is at most limit bytes, cut where a cut is safe: on a UTF-8 boundary, and never where the next piece would lead with a parameter-shaped segment. A body within limit is one chunk; an empty body has none.