Skip to main content

take_within

Function take_within 

Source
fn take_within<T>(
    items: impl IntoIterator<Item = T>,
    budget_bytes: usize,
    size: impl Fn(&T) -> usize,
) -> (Vec<T>, bool)
Expand description

Takes items while they fit budget_bytes, at least one, measuring none past the last taken; true when items were left over.