From 8d6b4c40bfd3047195365de7a0a0e1009c446add Mon Sep 17 00:00:00 2001 From: Hanno Braun Date: Tue, 20 Sep 2022 18:25:09 +0200 Subject: [PATCH 1/8] Simplify `CycleBuilder` --- crates/fj-kernel/src/builder/cycle.rs | 16 +++++++--------- crates/fj-kernel/src/objects/cycle.rs | 2 +- 2 files changed, 8 insertions(+), 10 deletions(-) diff --git a/crates/fj-kernel/src/builder/cycle.rs b/crates/fj-kernel/src/builder/cycle.rs index b16a12fe3..0c8fd5b01 100644 --- a/crates/fj-kernel/src/builder/cycle.rs +++ b/crates/fj-kernel/src/builder/cycle.rs @@ -6,19 +6,17 @@ use crate::{ }; /// API for building a [`Cycle`] +/// +/// Also see [`Cycle::build`]. pub struct CycleBuilder<'a> { - stores: &'a Stores, - surface: Surface, + /// The stores that the created objects are put in + pub stores: &'a Stores, + + /// The surface that the [`Cycle`] is defined in + pub surface: Surface, } impl<'a> CycleBuilder<'a> { - /// Construct an instance of `CycleBuilder` - /// - /// Also see [`Cycle::build`]. - pub fn new(stores: &'a Stores, surface: Surface) -> Self { - Self { stores, surface } - } - /// Create a polygon from a list of points pub fn polygon_from_points( &self, diff --git a/crates/fj-kernel/src/objects/cycle.rs b/crates/fj-kernel/src/objects/cycle.rs index 58c9830e2..49cd0d0d9 100644 --- a/crates/fj-kernel/src/objects/cycle.rs +++ b/crates/fj-kernel/src/objects/cycle.rs @@ -15,7 +15,7 @@ pub struct Cycle { impl Cycle { /// Build a cycle using [`CycleBuilder`] pub fn build(stores: &Stores, surface: Surface) -> CycleBuilder { - CycleBuilder::new(stores, surface) + CycleBuilder { stores, surface } } /// Create a new cycle From 158636f0f191c38959b9636c543dd4ccd13501af Mon Sep 17 00:00:00 2001 From: Hanno Braun Date: Tue, 20 Sep 2022 18:27:27 +0200 Subject: [PATCH 2/8] Simplify `HalfEdgeBuilder` --- crates/fj-kernel/src/builder/edge.rs | 16 +++++++--------- crates/fj-kernel/src/objects/edge.rs | 2 +- 2 files changed, 8 insertions(+), 10 deletions(-) diff --git a/crates/fj-kernel/src/builder/edge.rs b/crates/fj-kernel/src/builder/edge.rs index 26df2eb7b..f87e03f8a 100644 --- a/crates/fj-kernel/src/builder/edge.rs +++ b/crates/fj-kernel/src/builder/edge.rs @@ -10,19 +10,17 @@ use crate::{ }; /// API for building an [`HalfEdge`] +/// +/// Also see [`HalfEdge::build`]. pub struct HalfEdgeBuilder<'a> { - stores: &'a Stores, - surface: Surface, + /// The stores that the created objects are put in + pub stores: &'a Stores, + + /// The surface that the [`HalfEdge`] is defined in + pub surface: Surface, } impl<'a> HalfEdgeBuilder<'a> { - /// Construct a new instance of [`HalfEdgeBuilder`] - /// - /// Also see [`HalfEdge::build`]. - pub fn new(stores: &'a Stores, surface: Surface) -> Self { - Self { stores, surface } - } - /// Build a circle from the given radius pub fn circle_from_radius(&self, radius: impl Into) -> HalfEdge { let curve = diff --git a/crates/fj-kernel/src/objects/edge.rs b/crates/fj-kernel/src/objects/edge.rs index 6d034be50..3e599af93 100644 --- a/crates/fj-kernel/src/objects/edge.rs +++ b/crates/fj-kernel/src/objects/edge.rs @@ -18,7 +18,7 @@ pub struct HalfEdge { impl HalfEdge { /// Build a half-edge using [`HalfEdgeBuilder`] pub fn build(stores: &Stores, surface: Surface) -> HalfEdgeBuilder { - HalfEdgeBuilder::new(stores, surface) + HalfEdgeBuilder { stores, surface } } /// Create a new instance of `HalfEdge` From fd30aa9098a98268f3e95cbeaefc7935f8a37271 Mon Sep 17 00:00:00 2001 From: Hanno Braun Date: Tue, 20 Sep 2022 18:34:22 +0200 Subject: [PATCH 3/8] Simplify `CurveBuilder` --- crates/fj-kernel/src/builder/curve.rs | 16 +++++++--------- crates/fj-kernel/src/objects/curve.rs | 2 +- 2 files changed, 8 insertions(+), 10 deletions(-) diff --git a/crates/fj-kernel/src/builder/curve.rs b/crates/fj-kernel/src/builder/curve.rs index db9e5f5df..9068dd687 100644 --- a/crates/fj-kernel/src/builder/curve.rs +++ b/crates/fj-kernel/src/builder/curve.rs @@ -7,19 +7,17 @@ use crate::{ }; /// API for building a [`Curve`] +/// +/// Also see [`Curve::build`]. pub struct CurveBuilder<'a> { - stores: &'a Stores, - surface: Surface, + /// The stores that the created objects are put in + pub stores: &'a Stores, + + /// The surface that the [`Curve`] is defined in + pub surface: Surface, } impl<'a> CurveBuilder<'a> { - /// Construct a new instance of [`CurveBuilder`] - /// - /// Also see [`Curve::build`]. - pub fn new(stores: &'a Stores, surface: Surface) -> Self { - Self { stores, surface } - } - /// Build a line that represents the u-axis on the surface pub fn u_axis(&self) -> Curve { let a = Point::origin(); diff --git a/crates/fj-kernel/src/objects/curve.rs b/crates/fj-kernel/src/objects/curve.rs index 134c4710c..e28c4a0f5 100644 --- a/crates/fj-kernel/src/objects/curve.rs +++ b/crates/fj-kernel/src/objects/curve.rs @@ -17,7 +17,7 @@ pub struct Curve { impl Curve { /// Build a curve using [`CurveBuilder`] pub fn build(stores: &Stores, surface: Surface) -> CurveBuilder { - CurveBuilder::new(stores, surface) + CurveBuilder { stores, surface } } /// Construct a new instance of `Curve` From aa87767ab5a30eeb9abe3e3e6cb36c9f472af70e Mon Sep 17 00:00:00 2001 From: Hanno Braun Date: Tue, 20 Sep 2022 18:36:37 +0200 Subject: [PATCH 4/8] Simplify `FaceBuilder` --- crates/fj-kernel/src/builder/face.rs | 16 +++++++--------- crates/fj-kernel/src/objects/face.rs | 2 +- 2 files changed, 8 insertions(+), 10 deletions(-) diff --git a/crates/fj-kernel/src/builder/face.rs b/crates/fj-kernel/src/builder/face.rs index 2f1bee5ee..9923fdb8a 100644 --- a/crates/fj-kernel/src/builder/face.rs +++ b/crates/fj-kernel/src/builder/face.rs @@ -8,19 +8,17 @@ use crate::{ }; /// API for building a [`Face`] +/// +/// Also see [`Face::build`]. pub struct FaceBuilder<'a> { - stores: &'a Stores, - surface: Surface, + /// The stores that the created objects are put in + pub stores: &'a Stores, + + /// The surface that the [`Face`] is defined in + pub surface: Surface, } impl<'a> FaceBuilder<'a> { - /// Construct an instance of `FaceBuilder` - /// - /// Also see [`Face::build`]. - pub fn new(stores: &'a Stores, surface: Surface) -> Self { - Self { stores, surface } - } - /// Construct a polygon from a list of points pub fn polygon_from_points( &self, diff --git a/crates/fj-kernel/src/objects/face.rs b/crates/fj-kernel/src/objects/face.rs index 38e3281c9..f83a37d30 100644 --- a/crates/fj-kernel/src/objects/face.rs +++ b/crates/fj-kernel/src/objects/face.rs @@ -67,7 +67,7 @@ pub struct Face { impl Face { /// Build a face using [`FaceBuilder`] pub fn build(stores: &Stores, surface: Surface) -> FaceBuilder { - FaceBuilder::new(stores, surface) + FaceBuilder { stores, surface } } /// Construct a new instance of `Face` From af8fd56d8fc48ed4630d7f31341e524812095ea5 Mon Sep 17 00:00:00 2001 From: Hanno Braun Date: Tue, 20 Sep 2022 18:37:57 +0200 Subject: [PATCH 5/8] Simplify `ShellBuilder` --- crates/fj-kernel/src/builder/shell.rs | 12 ++++-------- crates/fj-kernel/src/objects/shell.rs | 2 +- 2 files changed, 5 insertions(+), 9 deletions(-) diff --git a/crates/fj-kernel/src/builder/shell.rs b/crates/fj-kernel/src/builder/shell.rs index b12a04393..6bd2f9384 100644 --- a/crates/fj-kernel/src/builder/shell.rs +++ b/crates/fj-kernel/src/builder/shell.rs @@ -7,18 +7,14 @@ use crate::{ }; /// API for building a [`Shell`] +/// +/// Also see [`Shell::build`]. pub struct ShellBuilder<'a> { - stores: &'a Stores, + /// The stores that the created objects are put in + pub stores: &'a Stores, } impl<'a> ShellBuilder<'a> { - /// Construct a new instance of `ShellBuilder` - /// - /// Also see [`Shell::build`]. - pub fn new(stores: &'a Stores) -> Self { - Self { stores } - } - /// Create a cube from the length of its edges pub fn cube_from_edge_length( &self, diff --git a/crates/fj-kernel/src/objects/shell.rs b/crates/fj-kernel/src/objects/shell.rs index 77ef3023c..3b554297c 100644 --- a/crates/fj-kernel/src/objects/shell.rs +++ b/crates/fj-kernel/src/objects/shell.rs @@ -16,7 +16,7 @@ pub struct Shell { impl Shell { /// Build a shell using [`ShellBuilder`] pub fn build(stores: &Stores) -> ShellBuilder { - ShellBuilder::new(stores) + ShellBuilder { stores } } /// Construct an empty instance of `Shell` From ce6c3b4b2a978b46fa5333d41f63ced17689cb4e Mon Sep 17 00:00:00 2001 From: Hanno Braun Date: Tue, 20 Sep 2022 18:39:36 +0200 Subject: [PATCH 6/8] Simplify `SketchBuilder` --- crates/fj-kernel/src/builder/sketch.rs | 16 +++++++--------- crates/fj-kernel/src/objects/sketch.rs | 2 +- 2 files changed, 8 insertions(+), 10 deletions(-) diff --git a/crates/fj-kernel/src/builder/sketch.rs b/crates/fj-kernel/src/builder/sketch.rs index 9a1a99b97..c30e3bf42 100644 --- a/crates/fj-kernel/src/builder/sketch.rs +++ b/crates/fj-kernel/src/builder/sketch.rs @@ -6,19 +6,17 @@ use crate::{ }; /// API for building a [`Sketch`] +/// +/// Also see [`Sketch::build`]. pub struct SketchBuilder<'a> { - stores: &'a Stores, - surface: Surface, + /// The stores that the created objects are put in + pub stores: &'a Stores, + + /// The surface that the [`Sketch`] is defined in + pub surface: Surface, } impl<'a> SketchBuilder<'a> { - /// Construct an instance of `SketchBuilder` - /// - /// Also see [`Sketch::build`]. - pub fn new(stores: &'a Stores, surface: Surface) -> Self { - Self { stores, surface } - } - /// Construct a polygon from a list of points pub fn polygon_from_points( &self, diff --git a/crates/fj-kernel/src/objects/sketch.rs b/crates/fj-kernel/src/objects/sketch.rs index d9c38516f..d9c886cf6 100644 --- a/crates/fj-kernel/src/objects/sketch.rs +++ b/crates/fj-kernel/src/objects/sketch.rs @@ -16,7 +16,7 @@ pub struct Sketch { impl Sketch { /// Build a sketch using [`SketchBuilder`] pub fn build(stores: &Stores, surface: Surface) -> SketchBuilder { - SketchBuilder::new(stores, surface) + SketchBuilder { stores, surface } } /// Construct an empty instance of `Sketch` From 258193bd9da35c8819063b05ac876b3132dbf9ac Mon Sep 17 00:00:00 2001 From: Hanno Braun Date: Tue, 20 Sep 2022 18:40:21 +0200 Subject: [PATCH 7/8] Simplify `SolidBuilder` --- crates/fj-kernel/src/builder/solid.rs | 12 ++++-------- crates/fj-kernel/src/objects/solid.rs | 2 +- 2 files changed, 5 insertions(+), 9 deletions(-) diff --git a/crates/fj-kernel/src/builder/solid.rs b/crates/fj-kernel/src/builder/solid.rs index 7e83d25bd..f286e706f 100644 --- a/crates/fj-kernel/src/builder/solid.rs +++ b/crates/fj-kernel/src/builder/solid.rs @@ -6,18 +6,14 @@ use crate::{ }; /// API for building a [`Solid`] +/// +/// Also see [`Solid::build`]. pub struct SolidBuilder<'a> { - stores: &'a Stores, + /// The stores that the created objects are put in + pub stores: &'a Stores, } impl<'a> SolidBuilder<'a> { - /// Construct a new instance of `SolidBuilder` - /// - /// Also see [`Solid::build`]. - pub fn new(stores: &'a Stores) -> Self { - Self { stores } - } - /// Create a cube from the length of its edges pub fn cube_from_edge_length( &self, diff --git a/crates/fj-kernel/src/objects/solid.rs b/crates/fj-kernel/src/objects/solid.rs index 59d9aefa0..f5ab5c8b6 100644 --- a/crates/fj-kernel/src/objects/solid.rs +++ b/crates/fj-kernel/src/objects/solid.rs @@ -18,7 +18,7 @@ pub struct Solid { impl Solid { /// Build a solid using [`SolidBuilder`] pub fn build(stores: &Stores) -> SolidBuilder { - SolidBuilder::new(stores) + SolidBuilder { stores } } /// Construct an empty instance of `Solid` From 15f51167d80af0d853493dd1f89d1cd6d71fe735 Mon Sep 17 00:00:00 2001 From: Hanno Braun Date: Tue, 20 Sep 2022 18:41:39 +0200 Subject: [PATCH 8/8] Simplify `VertexBuilder` --- crates/fj-kernel/src/builder/vertex.rs | 12 ++++-------- crates/fj-kernel/src/objects/vertex.rs | 2 +- 2 files changed, 5 insertions(+), 9 deletions(-) diff --git a/crates/fj-kernel/src/builder/vertex.rs b/crates/fj-kernel/src/builder/vertex.rs index 6eb4d30ba..3af18eac0 100644 --- a/crates/fj-kernel/src/builder/vertex.rs +++ b/crates/fj-kernel/src/builder/vertex.rs @@ -3,18 +3,14 @@ use fj_math::Point; use crate::objects::{Curve, GlobalVertex, Surface, SurfaceVertex, Vertex}; /// API for building a [`Vertex`] +/// +/// Also see [`Vertex::build`]. pub struct VertexBuilder { - curve: Curve, + /// The curve that the [`Vertex`] is defined in + pub curve: Curve, } impl VertexBuilder { - /// Construct a new instance of `VertexBuilder` - /// - /// Also see [`Vertex::build`]. - pub fn new(curve: Curve) -> Self { - Self { curve } - } - /// Build a vertex from a curve position pub fn from_point(&self, point: impl Into>) -> Vertex { let point = point.into(); diff --git a/crates/fj-kernel/src/objects/vertex.rs b/crates/fj-kernel/src/objects/vertex.rs index 4d2f97598..32128a994 100644 --- a/crates/fj-kernel/src/objects/vertex.rs +++ b/crates/fj-kernel/src/objects/vertex.rs @@ -21,7 +21,7 @@ pub struct Vertex { impl Vertex { /// Build a vertex using [`VertexBuilder`] pub fn build(curve: Curve) -> VertexBuilder { - VertexBuilder::new(curve) + VertexBuilder { curve } } /// Construct an instance of `Vertex`