Page MenuHomePhabricator

[comm-lib] Add util to split vec into n chunks
ClosedPublic

Authored by bartek on Aug 21 2024, 1:31 AM.
Tags
None
Referenced Files
Unknown Object (File)
Fri, Nov 8, 7:03 PM
Unknown Object (File)
Fri, Nov 8, 7:03 PM
Unknown Object (File)
Fri, Nov 8, 7:01 PM
Unknown Object (File)
Fri, Oct 25, 2:37 AM
Unknown Object (File)
Wed, Oct 23, 10:12 AM
Unknown Object (File)
Oct 18 2024, 5:57 PM
Unknown Object (File)
Sep 25 2024, 1:31 AM
Unknown Object (File)
Sep 25 2024, 1:31 AM
Subscribers

Details

Summary

The built-in vec.chunks(5) splits given collection into chunks of 5 items. Number of chunks is determined based on collection size.
However, there's no built-in utility for splitting collection into 5 chunks, where chunk sizes are determined based on collection size.

There are crates like itertools but it's an overkill to add a new dependency for such simple utility.
Created a simple trait that adds this functionality.

Test Plan

Unit tests

Diff Detail

Repository
rCOMM Comm
Lint
No Lint Coverage
Unit
No Test Coverage