0.4.2 (current) Thoroughness: Low Understanding: Low
by kpreid on 2023-08-14
This review is from Crev, a distributed system for code reviews. To add your review, set up cargo-crev
.
0.4.2 (current) Thoroughness: Low Understanding: Low
by kpreid on 2023-08-14
Lib.rs has been able to verify that all files in the crate's tarball are in the crate's repository. Please note that this check is still in beta, and absence of this confirmation does not mean that the files don't match.
Crates in the crates.io registry are tarball snapshots uploaded by crates' publishers. The registry is not using crates' git repositories, so there is a possibility that published crates have a misleading repository URL, or contain different code from the code in the repository.
To review the actual code of the crate, it's best to use cargo crev open rectangle-pack
. Alternatively, you can download the tarball of rectangle-pack v0.4.2 or view the source online.
Meta: I have reviewed this package as part of a search for rectangle-packing algorithm implementations. I have not yet reviewed other packages, nor yet fully exercised this one. That said, my observations so far:
The code is straightforwardly written, and does not pose significant risks (other than correctness of the algorithm, which I have not evaluated). However, there are some caveats you may wish to consider.
While
no_std
is supported, the code does requirealloc
and will allocate inside of its algorithms.Documentation is unclear. Broadly, it describes the purpose of items but fails to describe how to actually use or implement them, except in examples:
GroupedRectsToPlace
does not explain what to do with the type parametersRectToPlaceId
andGroupId
.ComparePotentialContainersFn
andcontains_smallest_box()
, what is a[WidthHeightDepth; 3]
? Why are exactly three boxes being passed? The answer may be found inBinSection::try_place()
's documentation, but only by implication.BoxSizeHeuristicFn
, why would one use anything other thanvolume_heuristic()
, multiplying to obtain the volume?The type
WidthHeightDepth
is not public; this does not prevent the library from being used since its values are only ever provided, not consumed, but it is inelegant and potentially inconvenient since the requirement to provide a function acceptingWidthHeightDepth
can only be satisfied by a closure.Comments on internal code quality, not relevant to usage:
KeyValMap
could be conditionally defined in one place as a type alias instead of twice in two modules.There are several pieces of unfinished, unused (but private) code.