refactor(ApplyGeometryEdit): make 'apply' take 'GeometryEdit' by reference

This commit is contained in:
Alain Emilia Anna Zscheile 2024-12-06 20:16:56 +01:00 committed by mikolaj
parent 27a4b61c4d
commit 5a26c02b4e
6 changed files with 7 additions and 7 deletions

View File

@ -175,7 +175,7 @@ impl<M: AccessMesadata> Invoker<M> {
let last_done = self.history.last_done()?;
if let Some(edit) = last_done.edit() {
self.autorouter.board.apply(edit.reverse());
self.autorouter.board.apply(&edit.reverse());
}
Ok(self.history.undo()?)
@ -187,7 +187,7 @@ impl<M: AccessMesadata> Invoker<M> {
let last_undone = self.history.last_undone()?;
if let Some(edit) = last_undone.edit() {
self.autorouter.board.apply(edit.clone());
self.autorouter.board.apply(edit);
}
Ok(self.history.redo()?)

View File

@ -274,7 +274,7 @@ impl<M: AccessMesadata>
BendIndex,
> for Board<M>
{
fn apply(&mut self, edit: LayoutEdit) {
fn apply(&mut self, edit: &LayoutEdit) {
self.layout.apply(edit);
}
}

View File

@ -1134,7 +1134,7 @@ impl<CW: Copy, R: AccessRules>
BendIndex,
> for Drawing<CW, R>
{
fn apply(&mut self, edit: DrawingEdit<CW>) {
fn apply(&mut self, edit: &DrawingEdit<CW>) {
self.recording_geometry_with_rtree.apply(edit);
}
}

View File

@ -19,7 +19,7 @@ pub trait ApplyGeometryEdit<
BI: GetPetgraphIndex + Into<PI> + Eq + Hash + Copy,
>
{
fn apply(&mut self, edit: GeometryEdit<PW, DW, SW, BW, CW, PI, DI, SI, BI>);
fn apply(&mut self, edit: &GeometryEdit<PW, DW, SW, BW, CW, PI, DI, SI, BI>);
}
#[derive(Debug, Clone)]

View File

@ -395,7 +395,7 @@ impl<
> ApplyGeometryEdit<PW, DW, SW, BW, CW, PI, DI, SI, BI>
for RecordingGeometryWithRtree<PW, DW, SW, BW, CW, PI, DI, SI, BI>
{
fn apply(&mut self, edit: GeometryEdit<PW, DW, SW, BW, CW, PI, DI, SI, BI>) {
fn apply(&mut self, edit: &GeometryEdit<PW, DW, SW, BW, CW, PI, DI, SI, BI>) {
for (compound, (maybe_old_data, ..)) in &edit.compounds {
if maybe_old_data.is_some() {
self.geometry_with_rtree.remove_compound(*compound);

View File

@ -341,7 +341,7 @@ impl<R: AccessRules>
BendIndex,
> for Layout<R>
{
fn apply(&mut self, edit: LayoutEdit) {
fn apply(&mut self, edit: &LayoutEdit) {
self.drawing.apply(edit);
}
}