toChunks package:bytebuild
Variant of
reverseCommitsOntoChunks that does not reverse the
order of the commits. Since commits are built backwards by consing,
this means that the chunks appended to the front will be backwards.
Within each chunk, however, the bytes will be in the correct order.
Unlike
reverseCommitsOntoChunks, this function is not tail
recursive.
Cons the chunks from a list of Commits onto an initial
Chunks list (this argument is often ChunksNil). This
reverses the order of the chunks, which is desirable since builders
assemble Commits with the chunks backwards. This performs an
in-place shrink and freezes any mutable byte arrays it encounters.
Consequently, these must not be reused.