Simplify return value of ConnectExt::connect

This commit is contained in:
Hanno Braun 2025-02-18 20:05:08 +01:00
parent e9fde5da24
commit 85c7253bcf
2 changed files with 6 additions and 11 deletions

View File

@ -25,11 +25,11 @@ pub trait ConnectExt {
/// ///
/// It should be seen as more of a placeholder for a real implementation of /// It should be seen as more of a placeholder for a real implementation of
/// this operation. /// this operation.
fn connect(self, other: Self) -> Connect; fn connect(self, other: Self) -> Handle<Solid>;
} }
impl ConnectExt for Handle<Face> { impl ConnectExt for Handle<Face> {
fn connect(self, other: Self) -> Connect { fn connect(self, other: Self) -> Handle<Solid> {
assert_eq!( assert_eq!(
self.output().vertices().count(), self.output().vertices().count(),
other.output().vertices().count(), other.output().vertices().count(),
@ -53,9 +53,7 @@ impl ConnectExt for Handle<Face> {
.collect::<Vec<_>>(); .collect::<Vec<_>>();
let output = Solid::new([self, other].into_iter().chain(side_faces)); let output = Solid::new([self, other].into_iter().chain(side_faces));
Connect { Handle::new(output)
output: Handle::new(output),
}
} }
} }

View File

@ -7,10 +7,7 @@ use crate::{
}; };
use super::{ use super::{
connect::{Connect, ConnectExt}, connect::ConnectExt, face::Face, flip::FlipExt, solid::Solid,
face::Face,
flip::FlipExt,
solid::Solid,
translate::TranslateExt, translate::TranslateExt,
}; };
@ -40,7 +37,7 @@ impl SweepExt for Handle<Face> {
} }
pub struct Sweep { pub struct Sweep {
pub output: Connect, pub output: Handle<Solid>,
} }
impl Operation for Sweep { impl Operation for Sweep {
@ -59,6 +56,6 @@ impl Operation for Sweep {
impl OperationOutput<Solid> for Sweep { impl OperationOutput<Solid> for Sweep {
fn output(&self) -> &Solid { fn output(&self) -> &Solid {
self.output.output.output() self.output.output()
} }
} }