Skip to content

Commit

Permalink
Prepare to show more operations in tree
Browse files Browse the repository at this point in the history
  • Loading branch information
hannobraun committed Feb 6, 2025
1 parent c1f9c5f commit a103498
Show file tree
Hide file tree
Showing 8 changed files with 12 additions and 30 deletions.
10 changes: 3 additions & 7 deletions experiments/2024-12-09/src/geometry/operation.rs
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,8 @@ pub trait Operation {
}
}

pub trait OperationOutput: Operation {
type Output;

fn output(&self) -> &Self::Output;
pub trait OperationOutput<Output = Self>: Operation {
fn output(&self) -> &Output;
}

pub struct OperationDisplay<'r> {
Expand Down Expand Up @@ -103,9 +101,7 @@ impl Operation for AnyOp {
}

impl OperationOutput for AnyOp {
type Output = Self;

fn output(&self) -> &Self::Output {
fn output(&self) -> &Self {
self
}
}
4 changes: 1 addition & 3 deletions experiments/2024-12-09/src/geometry/triangle.rs
Original file line number Diff line number Diff line change
Expand Up @@ -40,9 +40,7 @@ impl Operation for Triangle {
}

impl OperationOutput for Triangle {
type Output = Self;

fn output(&self) -> &Self::Output {
fn output(&self) -> &Self {
self
}
}
6 changes: 2 additions & 4 deletions experiments/2024-12-09/src/topology/connect.rs
Original file line number Diff line number Diff line change
Expand Up @@ -75,10 +75,8 @@ impl Operation for Connect {
}
}

impl OperationOutput for Connect {
type Output = Solid;

fn output(&self) -> &Self::Output {
impl OperationOutput<Solid> for Connect {
fn output(&self) -> &Solid {
&self.output
}
}
4 changes: 1 addition & 3 deletions experiments/2024-12-09/src/topology/face.rs
Original file line number Diff line number Diff line change
Expand Up @@ -121,9 +121,7 @@ impl Operation for Face {
}

impl OperationOutput for Face {
type Output = Self;

fn output(&self) -> &Self::Output {
fn output(&self) -> &Self {
self
}
}
Expand Down
4 changes: 1 addition & 3 deletions experiments/2024-12-09/src/topology/solid.rs
Original file line number Diff line number Diff line change
Expand Up @@ -36,9 +36,7 @@ impl Operation for Solid {
}
}
impl OperationOutput for Solid {
type Output = Self;

fn output(&self) -> &Self::Output {
fn output(&self) -> &Self {
self
}
}
6 changes: 2 additions & 4 deletions experiments/2024-12-09/src/topology/sweep.rs
Original file line number Diff line number Diff line change
Expand Up @@ -56,10 +56,8 @@ impl Operation for Sweep {
}
}

impl OperationOutput for Sweep {
type Output = Solid;

fn output(&self) -> &Self::Output {
impl OperationOutput<Solid> for Sweep {
fn output(&self) -> &Solid {
self.output.output()
}
}
4 changes: 1 addition & 3 deletions experiments/2024-12-09/src/topology/vertex.rs
Original file line number Diff line number Diff line change
Expand Up @@ -44,9 +44,7 @@ impl Operation for Vertex {
}

impl OperationOutput for Vertex {
type Output = Self;

fn output(&self) -> &Self::Output {
fn output(&self) -> &Self {
self
}
}
4 changes: 1 addition & 3 deletions experiments/2024-12-09/src/view.rs
Original file line number Diff line number Diff line change
Expand Up @@ -133,9 +133,7 @@ impl Operation for OperationView {
}

impl OperationOutput for OperationView {
type Output = Self;

fn output(&self) -> &Self::Output {
fn output(&self) -> &Self {
self
}
}

0 comments on commit a103498

Please sign in to comment.