Skip to content

Commit

Permalink
Document trait bounds in great detail
Browse files Browse the repository at this point in the history
So we know what the hell we were doing if we ever have to revisit this
  • Loading branch information
urschrei committed Nov 6, 2024
1 parent f8a9e26 commit 671fe59
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions geo/src/algorithm/bool_ops/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -192,9 +192,15 @@ pub trait UnaryUnion {
// "reduce" operations on parent nodes combine these output MultiPolygons from leaf operations by recursion
fn bottom_up_fold_reduce<T, S, I, F, R>(ops: &Ops<I, F, R>, parent: &ParentNode<T>) -> S
where
// This operation only requires two types: output (S) and input (T)
T: RTreeObject,
// Because this is a fold operation, we need to initialise a "container" to which we'll be adding using union.
// The output of a union op is a MultiPolygon.
I: Fn() -> S,
// The meat of the fold op is unioning input borrowed leaf Polygons into an output MultiPolygon.
F: Fn(S, &T) -> S,
// Parent nodes require us to process their child nodes to produce a MultiPolygon. We do this recursively.
// This is a reduce op so there's no need for an init value and the two inputs must have the same type: MultiPolygon
R: Fn(S, S) -> S,
{
parent
Expand Down

0 comments on commit 671fe59

Please sign in to comment.