Skip to content

Commit a103498

Browse files
committed
Prepare to show more operations in tree
1 parent c1f9c5f commit a103498

File tree

8 files changed

+12
-30
lines changed

8 files changed

+12
-30
lines changed

experiments/2024-12-09/src/geometry/operation.rs

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -15,10 +15,8 @@ pub trait Operation {
1515
}
1616
}
1717

18-
pub trait OperationOutput: Operation {
19-
type Output;
20-
21-
fn output(&self) -> &Self::Output;
18+
pub trait OperationOutput<Output = Self>: Operation {
19+
fn output(&self) -> &Output;
2220
}
2321

2422
pub struct OperationDisplay<'r> {
@@ -103,9 +101,7 @@ impl Operation for AnyOp {
103101
}
104102

105103
impl OperationOutput for AnyOp {
106-
type Output = Self;
107-
108-
fn output(&self) -> &Self::Output {
104+
fn output(&self) -> &Self {
109105
self
110106
}
111107
}

experiments/2024-12-09/src/geometry/triangle.rs

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -40,9 +40,7 @@ impl Operation for Triangle {
4040
}
4141

4242
impl OperationOutput for Triangle {
43-
type Output = Self;
44-
45-
fn output(&self) -> &Self::Output {
43+
fn output(&self) -> &Self {
4644
self
4745
}
4846
}

experiments/2024-12-09/src/topology/connect.rs

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -75,10 +75,8 @@ impl Operation for Connect {
7575
}
7676
}
7777

78-
impl OperationOutput for Connect {
79-
type Output = Solid;
80-
81-
fn output(&self) -> &Self::Output {
78+
impl OperationOutput<Solid> for Connect {
79+
fn output(&self) -> &Solid {
8280
&self.output
8381
}
8482
}

experiments/2024-12-09/src/topology/face.rs

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -121,9 +121,7 @@ impl Operation for Face {
121121
}
122122

123123
impl OperationOutput for Face {
124-
type Output = Self;
125-
126-
fn output(&self) -> &Self::Output {
124+
fn output(&self) -> &Self {
127125
self
128126
}
129127
}

experiments/2024-12-09/src/topology/solid.rs

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -36,9 +36,7 @@ impl Operation for Solid {
3636
}
3737
}
3838
impl OperationOutput for Solid {
39-
type Output = Self;
40-
41-
fn output(&self) -> &Self::Output {
39+
fn output(&self) -> &Self {
4240
self
4341
}
4442
}

experiments/2024-12-09/src/topology/sweep.rs

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -56,10 +56,8 @@ impl Operation for Sweep {
5656
}
5757
}
5858

59-
impl OperationOutput for Sweep {
60-
type Output = Solid;
61-
62-
fn output(&self) -> &Self::Output {
59+
impl OperationOutput<Solid> for Sweep {
60+
fn output(&self) -> &Solid {
6361
self.output.output()
6462
}
6563
}

experiments/2024-12-09/src/topology/vertex.rs

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -44,9 +44,7 @@ impl Operation for Vertex {
4444
}
4545

4646
impl OperationOutput for Vertex {
47-
type Output = Self;
48-
49-
fn output(&self) -> &Self::Output {
47+
fn output(&self) -> &Self {
5048
self
5149
}
5250
}

experiments/2024-12-09/src/view.rs

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -133,9 +133,7 @@ impl Operation for OperationView {
133133
}
134134

135135
impl OperationOutput for OperationView {
136-
type Output = Self;
137-
138-
fn output(&self) -> &Self::Output {
136+
fn output(&self) -> &Self {
139137
self
140138
}
141139
}

0 commit comments

Comments
 (0)