Prepare for centralized operation stores

This commit is contained in:
Hanno Braun 2024-12-16 21:14:13 +01:00
parent 3754d46fcf
commit 784031af85

View File

@ -17,9 +17,9 @@ pub struct Shape {
impl Shape { impl Shape {
pub fn extend_with<'r, T>( pub fn extend_with<'r, T>(
&'r mut self, &'r mut self,
_: &'r mut Store<T>, store: &'r mut Store<T>,
) -> ShapeExtender<'r, (), T> { ) -> 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> { pub struct ShapeExtender<'r, NewOps, T> {
store: &'r mut Store<T>,
sequence: &'r mut Vec<OperationInSequence>, sequence: &'r mut Vec<OperationInSequence>,
new_ops: NewOps, new_ops: NewOps,
@ -98,8 +99,12 @@ pub struct ShapeExtender<'r, NewOps, T> {
} }
impl<'r, T> ShapeExtender<'r, (), T> { impl<'r, T> ShapeExtender<'r, (), T> {
fn new(sequence: &'r mut Vec<OperationInSequence>) -> Self { fn new(
store: &'r mut Store<T>,
sequence: &'r mut Vec<OperationInSequence>,
) -> Self {
Self { Self {
store,
sequence, sequence,
new_ops: (), new_ops: (),
_t: PhantomData, _t: PhantomData,
@ -121,6 +126,7 @@ impl<'r, NewOps, T> ShapeExtender<'r, NewOps, T> {
}); });
ShapeExtender { ShapeExtender {
store: self.store,
sequence: self.sequence, sequence: self.sequence,
new_ops: self.new_ops.push_right(vertex), new_ops: self.new_ops.push_right(vertex),
_t: PhantomData, _t: PhantomData,