From 784031af858d00d76107454322749284f3acaf8c Mon Sep 17 00:00:00 2001 From: Hanno Braun Date: Mon, 16 Dec 2024 21:14:13 +0100 Subject: [PATCH] Prepare for centralized operation stores --- experiments/2024-12-09/src/geometry/shape.rs | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/experiments/2024-12-09/src/geometry/shape.rs b/experiments/2024-12-09/src/geometry/shape.rs index ba14a4df2..590958392 100644 --- a/experiments/2024-12-09/src/geometry/shape.rs +++ b/experiments/2024-12-09/src/geometry/shape.rs @@ -17,9 +17,9 @@ pub struct Shape { impl Shape { pub fn extend_with<'r, T>( &'r mut self, - _: &'r mut Store, + store: &'r mut Store, ) -> ShapeExtender<'r, (), T> { - ShapeExtender::new(&mut self.sequence) + ShapeExtender::new(store, &mut self.sequence) } } @@ -83,6 +83,7 @@ impl fmt::Display for OperationInSequence { } pub struct ShapeExtender<'r, NewOps, T> { + store: &'r mut Store, sequence: &'r mut Vec, new_ops: NewOps, @@ -98,8 +99,12 @@ pub struct ShapeExtender<'r, NewOps, T> { } impl<'r, T> ShapeExtender<'r, (), T> { - fn new(sequence: &'r mut Vec) -> Self { + fn new( + store: &'r mut Store, + sequence: &'r mut Vec, + ) -> Self { Self { + store, sequence, new_ops: (), _t: PhantomData, @@ -121,6 +126,7 @@ impl<'r, NewOps, T> ShapeExtender<'r, NewOps, T> { }); ShapeExtender { + store: self.store, sequence: self.sequence, new_ops: self.new_ops.push_right(vertex), _t: PhantomData,