fixed ctx for closures

This commit is contained in:
AF 2023-06-16 14:02:27 +00:00
parent 0aa8080461
commit cc48cc1d24
2 changed files with 4 additions and 5 deletions

View File

@ -147,8 +147,7 @@ impl<'a, BT: BinaryTreesUnbalanced<'a> + BinaryTreesTryJoin<'a>> BinaryTreesTryJ
tr: Self::Tree, tr: Self::Tree,
) -> BTWrap<'a, Self, Self::Node> { ) -> BTWrap<'a, Self, Self::Node> {
let (hl, hr) = (self.0.height(&tl), self.0.height(&tr)); let (hl, hr) = (self.0.height(&tl), self.0.height(&tr));
let ctx = self.0.clone();
self.0 self.0
.balancing_bind(balanced(hl, hr), |_| ctx.try_join(tl, key, tr)) .balancing_bind(balanced(hl, hr), |_| self.0.try_join(tl, key, tr))
} }
} }

View File

@ -71,11 +71,11 @@ impl<'a, BT: BinaryTreesBindable<'a>> BinaryTrees<'a> for BoundTrees<BT> {
} }
fn resolve(&self, reference: &Self::Reference) -> BTWrap<'a, Self, Self::Node> { fn resolve(&self, reference: &Self::Reference) -> BTWrap<'a, Self, Self::Node> {
let ctx = self.clone(); let ctx = self.0.clone();
let bounds = reference.bounds.clone(); let bounds = reference.bounds.clone();
Self::bind(self.0.resolve(&reference.bound), move |node| { Self::bind(self.0.resolve(&reference.bound), move |node| {
let (_, _, key) = ctx.0.split(&node); let (_, _, key) = ctx.split(&node);
ctx.0.bounds_bind( ctx.bounds_bind(
bounds.clone().split(&key, ctx.comparator()), bounds.clone().split(&key, ctx.comparator()),
|(boundsl, boundsr)| { |(boundsl, boundsr)| {
Self::pure(BoundNode2 { Self::pure(BoundNode2 {