diff --git a/crates/fj-kernel/src/insert.rs b/crates/fj-kernel/src/insert.rs index 44aaed099..28b5aed58 100644 --- a/crates/fj-kernel/src/insert.rs +++ b/crates/fj-kernel/src/insert.rs @@ -13,7 +13,6 @@ use crate::{ /// Convenience trait to insert objects into their respective stores pub trait Insert: Sized + Validate { - // TASK: Make error more specific. /// Insert the object into its respective store fn insert( self, diff --git a/crates/fj-kernel/src/objects/curve.rs b/crates/fj-kernel/src/objects/full/curve.rs similarity index 98% rename from crates/fj-kernel/src/objects/curve.rs rename to crates/fj-kernel/src/objects/full/curve.rs index 5b9663ef7..34a5c4f1d 100644 --- a/crates/fj-kernel/src/objects/curve.rs +++ b/crates/fj-kernel/src/objects/full/curve.rs @@ -1,11 +1,10 @@ use crate::{ geometry::path::SurfacePath, get::Get, + objects::Surface, storage::{Handle, HandleWrapper}, }; -use super::Surface; - /// A curve, defined in local surface coordinates #[derive(Clone, Debug, Eq, PartialEq, Hash, Ord, PartialOrd)] pub struct Curve { diff --git a/crates/fj-kernel/src/objects/cycle.rs b/crates/fj-kernel/src/objects/full/cycle.rs similarity index 97% rename from crates/fj-kernel/src/objects/cycle.rs rename to crates/fj-kernel/src/objects/full/cycle.rs index 91633ef83..fa7a1ad18 100644 --- a/crates/fj-kernel/src/objects/cycle.rs +++ b/crates/fj-kernel/src/objects/full/cycle.rs @@ -3,9 +3,11 @@ use std::slice; use fj_interop::ext::SliceExt; use fj_math::{Scalar, Winding}; -use crate::{geometry::path::SurfacePath, storage::Handle}; - -use super::{HalfEdge, Surface}; +use crate::{ + geometry::path::SurfacePath, + objects::{HalfEdge, Surface}, + storage::Handle, +}; /// A cycle of connected half-edges #[derive(Clone, Debug, Eq, PartialEq, Hash, Ord, PartialOrd)] diff --git a/crates/fj-kernel/src/objects/edge.rs b/crates/fj-kernel/src/objects/full/edge.rs similarity index 98% rename from crates/fj-kernel/src/objects/edge.rs rename to crates/fj-kernel/src/objects/full/edge.rs index bdc84d25a..26531d127 100644 --- a/crates/fj-kernel/src/objects/edge.rs +++ b/crates/fj-kernel/src/objects/full/edge.rs @@ -2,11 +2,10 @@ use std::fmt; use crate::{ get::Get, + objects::{Curve, GlobalCurve, GlobalVertex, Surface, Vertex}, storage::{Handle, HandleWrapper}, }; -use super::{Curve, GlobalCurve, GlobalVertex, Surface, Vertex}; - /// A half-edge #[derive(Clone, Debug, Eq, PartialEq, Hash, Ord, PartialOrd)] pub struct HalfEdge { diff --git a/crates/fj-kernel/src/objects/face.rs b/crates/fj-kernel/src/objects/full/face.rs similarity index 97% rename from crates/fj-kernel/src/objects/face.rs rename to crates/fj-kernel/src/objects/full/face.rs index 7fba05e73..4606d1f98 100644 --- a/crates/fj-kernel/src/objects/face.rs +++ b/crates/fj-kernel/src/objects/full/face.rs @@ -3,9 +3,10 @@ use std::collections::{btree_set, BTreeSet}; use fj_interop::mesh::Color; use fj_math::Winding; -use crate::storage::Handle; - -use super::{Cycle, Surface}; +use crate::{ + objects::{Cycle, Surface}, + storage::Handle, +}; /// A face of a shape /// @@ -29,8 +30,8 @@ use super::{Cycle, Surface}; /// means that all [`HalfEdge`]s that bound a `Face` have the interior of the /// face on their left side (on the face's front side). /// -/// [`HalfEdge`]: super::HalfEdge -/// [`Shell`]: super::Shell +/// [`HalfEdge`]: crate::objects::HalfEdge +/// [`Shell`]: crate::objects::Shell #[derive(Clone, Debug, Eq, PartialEq, Hash, Ord, PartialOrd)] pub struct Face { exterior: Handle, diff --git a/crates/fj-kernel/src/objects/full/mod.rs b/crates/fj-kernel/src/objects/full/mod.rs new file mode 100644 index 000000000..1c2e5d303 --- /dev/null +++ b/crates/fj-kernel/src/objects/full/mod.rs @@ -0,0 +1,9 @@ +pub mod curve; +pub mod cycle; +pub mod edge; +pub mod face; +pub mod shell; +pub mod sketch; +pub mod solid; +pub mod surface; +pub mod vertex; diff --git a/crates/fj-kernel/src/objects/shell.rs b/crates/fj-kernel/src/objects/full/shell.rs similarity index 90% rename from crates/fj-kernel/src/objects/shell.rs rename to crates/fj-kernel/src/objects/full/shell.rs index cf3f13e0c..d1c1d6aac 100644 --- a/crates/fj-kernel/src/objects/shell.rs +++ b/crates/fj-kernel/src/objects/full/shell.rs @@ -1,6 +1,8 @@ -use crate::{builder::ShellBuilder, storage::Handle}; - -use super::{face::FaceSet, Face, Objects}; +use crate::{ + builder::ShellBuilder, + objects::{Face, FaceSet, Objects}, + storage::Handle, +}; /// A 3-dimensional closed shell /// diff --git a/crates/fj-kernel/src/objects/sketch.rs b/crates/fj-kernel/src/objects/full/sketch.rs similarity index 88% rename from crates/fj-kernel/src/objects/sketch.rs rename to crates/fj-kernel/src/objects/full/sketch.rs index 2164d4a23..b3c314a91 100644 --- a/crates/fj-kernel/src/objects/sketch.rs +++ b/crates/fj-kernel/src/objects/full/sketch.rs @@ -1,6 +1,8 @@ -use crate::{builder::SketchBuilder, storage::Handle}; - -use super::{face::FaceSet, Face, Objects}; +use crate::{ + builder::SketchBuilder, + objects::{Face, FaceSet, Objects}, + storage::Handle, +}; /// A 2-dimensional shape /// diff --git a/crates/fj-kernel/src/objects/solid.rs b/crates/fj-kernel/src/objects/full/solid.rs similarity index 92% rename from crates/fj-kernel/src/objects/solid.rs rename to crates/fj-kernel/src/objects/full/solid.rs index 84286d9ab..8ff6aa00e 100644 --- a/crates/fj-kernel/src/objects/solid.rs +++ b/crates/fj-kernel/src/objects/full/solid.rs @@ -1,8 +1,10 @@ use std::collections::BTreeSet; -use crate::{builder::SolidBuilder, storage::Handle}; - -use super::{Face, Objects, Shell}; +use crate::{ + builder::SolidBuilder, + objects::{Face, Objects, Shell}, + storage::Handle, +}; /// A 3-dimensional shape /// diff --git a/crates/fj-kernel/src/objects/surface.rs b/crates/fj-kernel/src/objects/full/surface.rs similarity index 100% rename from crates/fj-kernel/src/objects/surface.rs rename to crates/fj-kernel/src/objects/full/surface.rs diff --git a/crates/fj-kernel/src/objects/vertex.rs b/crates/fj-kernel/src/objects/full/vertex.rs similarity index 97% rename from crates/fj-kernel/src/objects/vertex.rs rename to crates/fj-kernel/src/objects/full/vertex.rs index d7b14adab..974e3f2f2 100644 --- a/crates/fj-kernel/src/objects/vertex.rs +++ b/crates/fj-kernel/src/objects/full/vertex.rs @@ -1,8 +1,10 @@ use fj_math::Point; -use crate::{get::Get, storage::Handle}; - -use super::{Curve, GlobalCurve, Surface}; +use crate::{ + get::Get, + objects::{Curve, GlobalCurve, Surface}, + storage::Handle, +}; /// A vertex /// diff --git a/crates/fj-kernel/src/objects/mod.rs b/crates/fj-kernel/src/objects/mod.rs index 221c245ef..ab0976fbc 100644 --- a/crates/fj-kernel/src/objects/mod.rs +++ b/crates/fj-kernel/src/objects/mod.rs @@ -73,348 +73,24 @@ //! [`Handle`]: crate::storage::Handle //! [#1021]: https://github.com/hannobraun/Fornjot/issues/1021 -mod curve; -mod cycle; -mod edge; -mod face; -mod shell; -mod sketch; -mod solid; -mod surface; -mod vertex; +mod full; +mod stores; pub use self::{ - curve::{Curve, GlobalCurve}, - cycle::{Cycle, HalfEdgesOfCycle}, - edge::{GlobalEdge, HalfEdge, VerticesInNormalizedOrder}, - face::{Face, FaceSet, Handedness}, - shell::Shell, - sketch::Sketch, - solid::Solid, - surface::Surface, - vertex::{GlobalVertex, SurfaceVertex, Vertex}, -}; - -use std::convert::Infallible; - -use fj_math::Vector; - -use crate::{ - geometry::{path::GlobalPath, surface::SurfaceGeometry}, - storage::{Handle, Store}, - validate::{ - CycleValidationError, FaceValidationError, HalfEdgeValidationError, - SurfaceVertexValidationError, Validate, VertexValidationError, + full::{ + curve::{Curve, GlobalCurve}, + cycle::{Cycle, HalfEdgesOfCycle}, + edge::{GlobalEdge, HalfEdge, VerticesInNormalizedOrder}, + face::{Face, FaceSet, Handedness}, + shell::Shell, + sketch::Sketch, + solid::Solid, + surface::Surface, + vertex::{GlobalVertex, SurfaceVertex, Vertex}, + }, + stores::{ + Curves, Cycles, Faces, GlobalCurves, GlobalEdges, GlobalVertices, + HalfEdges, Objects, Shells, Sketches, Solids, SurfaceVertices, + Surfaces, Vertices, }, }; - -/// The available object stores -/// -/// # Implementation Note -/// -/// The intention is to eventually manage all objects in here. Making this -/// happen is simply a case of putting in the required work. See [#1021]. -/// -/// [#1021]: https://github.com/hannobraun/Fornjot/issues/1021 -#[derive(Debug, Default)] -pub struct Objects { - /// Store for [`Curve`]s - pub curves: Curves, - - /// Store for [`Cycle`]s - pub cycles: Cycles, - - /// Store for [`Face`]s - pub faces: Faces, - - /// Store for [`GlobalCurve`]s - pub global_curves: GlobalCurves, - - /// Store for [`GlobalEdge`]s - pub global_edges: GlobalEdges, - - /// Store for [`GlobalVertex`] objects - pub global_vertices: GlobalVertices, - - /// Store for [`HalfEdge`]s - pub half_edges: HalfEdges, - - /// Store for [`Shell`]s - pub shells: Shells, - - /// Store for [`Sketch`]es - pub sketches: Sketches, - - /// Store for [`Solid`]s - pub solids: Solids, - - /// Store for [`SurfaceVertex`] objects - pub surface_vertices: SurfaceVertices, - - /// Store for [`Surface`]s - pub surfaces: Surfaces, - - /// Store for [`Vertex`] objects - pub vertices: Vertices, -} - -impl Objects { - /// Construct a new instance of `Stores` - pub fn new() -> Self { - Self::default() - } -} - -/// Store for [`Curve`]s -#[derive(Debug, Default)] -pub struct Curves { - store: Store, -} - -impl Curves { - /// Insert a [`Curve`] into the store - pub fn insert(&self, curve: Curve) -> Result, Infallible> { - curve.validate()?; - Ok(self.store.insert(curve)) - } -} - -/// Store for [`Cycle`]s -#[derive(Debug, Default)] -pub struct Cycles { - store: Store, -} - -impl Cycles { - /// Insert a [`Cycle`] into the store - pub fn insert( - &self, - cycle: Cycle, - ) -> Result, CycleValidationError> { - cycle.validate()?; - Ok(self.store.insert(cycle)) - } -} - -/// Store for [`Face`]s -#[derive(Debug, Default)] -pub struct Faces { - store: Store, -} - -impl Faces { - /// Insert a [`Face`] into the store - pub fn insert( - &self, - face: Face, - ) -> Result, FaceValidationError> { - face.validate()?; - Ok(self.store.insert(face)) - } -} - -/// Store for [`GlobalCurve`]s -#[derive(Debug, Default)] -pub struct GlobalCurves { - store: Store, -} - -impl GlobalCurves { - /// Insert a [`GlobalCurve`] into the store - pub fn insert( - &self, - global_curve: GlobalCurve, - ) -> Result, Infallible> { - global_curve.validate()?; - Ok(self.store.insert(global_curve)) - } -} - -/// Store for [`GlobalEdge`]s -#[derive(Debug, Default)] -pub struct GlobalEdges { - store: Store, -} - -impl GlobalEdges { - /// Insert a [`GlobalEdge`] into the store - pub fn insert( - &self, - global_edge: GlobalEdge, - ) -> Result, Infallible> { - global_edge.validate()?; - Ok(self.store.insert(global_edge)) - } -} - -/// Store for [`GlobalVertex`] objects -#[derive(Debug, Default)] -pub struct GlobalVertices { - store: Store, -} - -impl GlobalVertices { - /// Insert a [`GlobalVertex`] into the store - pub fn insert( - &self, - global_vertex: GlobalVertex, - ) -> Result, Infallible> { - global_vertex.validate()?; - Ok(self.store.insert(global_vertex)) - } -} - -/// Store for [`HalfEdge`]s -#[derive(Debug, Default)] -pub struct HalfEdges { - store: Store, -} - -impl HalfEdges { - /// Insert a [`HalfEdge`] into the store - pub fn insert( - &self, - half_edge: HalfEdge, - ) -> Result, HalfEdgeValidationError> { - half_edge.validate()?; - Ok(self.store.insert(half_edge)) - } -} - -/// Store for [`Shell`]s -#[derive(Debug, Default)] -pub struct Shells { - store: Store, -} - -impl Shells { - /// Insert a [`Shell`] into the store - pub fn insert(&self, shell: Shell) -> Result, Infallible> { - shell.validate()?; - Ok(self.store.insert(shell)) - } -} - -/// Store for [`Sketch`]es -#[derive(Debug, Default)] -pub struct Sketches { - store: Store, -} - -impl Sketches { - /// Insert a [`Sketch`] into the store - pub fn insert(&self, sketch: Sketch) -> Result, Infallible> { - sketch.validate()?; - Ok(self.store.insert(sketch)) - } -} - -/// Store for [`Solid`]s -#[derive(Debug, Default)] -pub struct Solids { - store: Store, -} - -impl Solids { - /// Insert a [`Solid`] into the store - pub fn insert(&self, solid: Solid) -> Result, Infallible> { - solid.validate()?; - Ok(self.store.insert(solid)) - } -} - -/// Store for [`SurfaceVertex`] objects -#[derive(Debug, Default)] -pub struct SurfaceVertices { - store: Store, -} - -impl SurfaceVertices { - /// Insert a [`SurfaceVertex`] into the store - pub fn insert( - &self, - surface_vertex: SurfaceVertex, - ) -> Result, SurfaceVertexValidationError> { - surface_vertex.validate()?; - Ok(self.store.insert(surface_vertex)) - } -} - -/// Store for [`Surface`]s -#[derive(Debug)] -pub struct Surfaces { - store: Store, - - xy_plane: Handle, - xz_plane: Handle, - yz_plane: Handle, -} - -impl Surfaces { - /// Insert a [`Surface`] into the store - pub fn insert( - &self, - surface: Surface, - ) -> Result, Infallible> { - surface.validate()?; - Ok(self.store.insert(surface)) - } - - /// Access the xy-plane - pub fn xy_plane(&self) -> Handle { - self.xy_plane.clone() - } - - /// Access the xz-plane - pub fn xz_plane(&self) -> Handle { - self.xz_plane.clone() - } - - /// Access the yz-plane - pub fn yz_plane(&self) -> Handle { - self.yz_plane.clone() - } -} - -impl Default for Surfaces { - fn default() -> Self { - let store = Store::new(); - - let xy_plane = store.insert(Surface::new(SurfaceGeometry { - u: GlobalPath::x_axis(), - v: Vector::unit_y(), - })); - let xz_plane = store.insert(Surface::new(SurfaceGeometry { - u: GlobalPath::x_axis(), - v: Vector::unit_z(), - })); - let yz_plane = store.insert(Surface::new(SurfaceGeometry { - u: GlobalPath::y_axis(), - v: Vector::unit_z(), - })); - - Self { - store, - xy_plane, - xz_plane, - yz_plane, - } - } -} - -/// Store for [`Vertex`] objects -#[derive(Debug, Default)] -pub struct Vertices { - store: Store, -} - -impl Vertices { - /// Insert a [`Vertex`] into the store - pub fn insert( - &self, - vertex: Vertex, - ) -> Result, VertexValidationError> { - vertex.validate()?; - Ok(self.store.insert(vertex)) - } -} diff --git a/crates/fj-kernel/src/objects/stores.rs b/crates/fj-kernel/src/objects/stores.rs new file mode 100644 index 000000000..153e4a4fc --- /dev/null +++ b/crates/fj-kernel/src/objects/stores.rs @@ -0,0 +1,328 @@ +use std::convert::Infallible; + +use fj_math::Vector; + +use crate::{ + geometry::{path::GlobalPath, surface::SurfaceGeometry}, + storage::{Handle, Store}, + validate::{ + CycleValidationError, FaceValidationError, HalfEdgeValidationError, + SurfaceVertexValidationError, Validate, VertexValidationError, + }, +}; + +use super::{ + Curve, Cycle, Face, GlobalCurve, GlobalEdge, GlobalVertex, HalfEdge, Shell, + Sketch, Solid, Surface, SurfaceVertex, Vertex, +}; + +/// The available object stores +/// +/// # Implementation Note +/// +/// The intention is to eventually manage all objects in here. Making this +/// happen is simply a case of putting in the required work. See [#1021]. +/// +/// [#1021]: https://github.com/hannobraun/Fornjot/issues/1021 +#[derive(Debug, Default)] +pub struct Objects { + /// Store for [`Curve`]s + pub curves: Curves, + + /// Store for [`Cycle`]s + pub cycles: Cycles, + + /// Store for [`Face`]s + pub faces: Faces, + + /// Store for [`GlobalCurve`]s + pub global_curves: GlobalCurves, + + /// Store for [`GlobalEdge`]s + pub global_edges: GlobalEdges, + + /// Store for [`GlobalVertex`] objects + pub global_vertices: GlobalVertices, + + /// Store for [`HalfEdge`]s + pub half_edges: HalfEdges, + + /// Store for [`Shell`]s + pub shells: Shells, + + /// Store for [`Sketch`]es + pub sketches: Sketches, + + /// Store for [`Solid`]s + pub solids: Solids, + + /// Store for [`SurfaceVertex`] objects + pub surface_vertices: SurfaceVertices, + + /// Store for [`Surface`]s + pub surfaces: Surfaces, + + /// Store for [`Vertex`] objects + pub vertices: Vertices, +} + +impl Objects { + /// Construct a new instance of `Stores` + pub fn new() -> Self { + Self::default() + } +} + +/// Store for [`Curve`]s +#[derive(Debug, Default)] +pub struct Curves { + store: Store, +} + +impl Curves { + /// Insert a [`Curve`] into the store + pub fn insert(&self, curve: Curve) -> Result, Infallible> { + curve.validate()?; + Ok(self.store.insert(curve)) + } +} + +/// Store for [`Cycle`]s +#[derive(Debug, Default)] +pub struct Cycles { + store: Store, +} + +impl Cycles { + /// Insert a [`Cycle`] into the store + pub fn insert( + &self, + cycle: Cycle, + ) -> Result, CycleValidationError> { + cycle.validate()?; + Ok(self.store.insert(cycle)) + } +} + +/// Store for [`Face`]s +#[derive(Debug, Default)] +pub struct Faces { + store: Store, +} + +impl Faces { + /// Insert a [`Face`] into the store + pub fn insert( + &self, + face: Face, + ) -> Result, FaceValidationError> { + face.validate()?; + Ok(self.store.insert(face)) + } +} + +/// Store for [`GlobalCurve`]s +#[derive(Debug, Default)] +pub struct GlobalCurves { + store: Store, +} + +impl GlobalCurves { + /// Insert a [`GlobalCurve`] into the store + pub fn insert( + &self, + global_curve: GlobalCurve, + ) -> Result, Infallible> { + global_curve.validate()?; + Ok(self.store.insert(global_curve)) + } +} + +/// Store for [`GlobalEdge`]s +#[derive(Debug, Default)] +pub struct GlobalEdges { + store: Store, +} + +impl GlobalEdges { + /// Insert a [`GlobalEdge`] into the store + pub fn insert( + &self, + global_edge: GlobalEdge, + ) -> Result, Infallible> { + global_edge.validate()?; + Ok(self.store.insert(global_edge)) + } +} + +/// Store for [`GlobalVertex`] objects +#[derive(Debug, Default)] +pub struct GlobalVertices { + store: Store, +} + +impl GlobalVertices { + /// Insert a [`GlobalVertex`] into the store + pub fn insert( + &self, + global_vertex: GlobalVertex, + ) -> Result, Infallible> { + global_vertex.validate()?; + Ok(self.store.insert(global_vertex)) + } +} + +/// Store for [`HalfEdge`]s +#[derive(Debug, Default)] +pub struct HalfEdges { + store: Store, +} + +impl HalfEdges { + /// Insert a [`HalfEdge`] into the store + pub fn insert( + &self, + half_edge: HalfEdge, + ) -> Result, HalfEdgeValidationError> { + half_edge.validate()?; + Ok(self.store.insert(half_edge)) + } +} + +/// Store for [`Shell`]s +#[derive(Debug, Default)] +pub struct Shells { + store: Store, +} + +impl Shells { + /// Insert a [`Shell`] into the store + pub fn insert(&self, shell: Shell) -> Result, Infallible> { + shell.validate()?; + Ok(self.store.insert(shell)) + } +} + +/// Store for [`Sketch`]es +#[derive(Debug, Default)] +pub struct Sketches { + store: Store, +} + +impl Sketches { + /// Insert a [`Sketch`] into the store + pub fn insert(&self, sketch: Sketch) -> Result, Infallible> { + sketch.validate()?; + Ok(self.store.insert(sketch)) + } +} + +/// Store for [`Solid`]s +#[derive(Debug, Default)] +pub struct Solids { + store: Store, +} + +impl Solids { + /// Insert a [`Solid`] into the store + pub fn insert(&self, solid: Solid) -> Result, Infallible> { + solid.validate()?; + Ok(self.store.insert(solid)) + } +} + +/// Store for [`SurfaceVertex`] objects +#[derive(Debug, Default)] +pub struct SurfaceVertices { + store: Store, +} + +impl SurfaceVertices { + /// Insert a [`SurfaceVertex`] into the store + pub fn insert( + &self, + surface_vertex: SurfaceVertex, + ) -> Result, SurfaceVertexValidationError> { + surface_vertex.validate()?; + Ok(self.store.insert(surface_vertex)) + } +} + +/// Store for [`Surface`]s +#[derive(Debug)] +pub struct Surfaces { + store: Store, + + xy_plane: Handle, + xz_plane: Handle, + yz_plane: Handle, +} + +impl Surfaces { + /// Insert a [`Surface`] into the store + pub fn insert( + &self, + surface: Surface, + ) -> Result, Infallible> { + surface.validate()?; + Ok(self.store.insert(surface)) + } + + /// Access the xy-plane + pub fn xy_plane(&self) -> Handle { + self.xy_plane.clone() + } + + /// Access the xz-plane + pub fn xz_plane(&self) -> Handle { + self.xz_plane.clone() + } + + /// Access the yz-plane + pub fn yz_plane(&self) -> Handle { + self.yz_plane.clone() + } +} + +impl Default for Surfaces { + fn default() -> Self { + let store = Store::new(); + + let xy_plane = store.insert(Surface::new(SurfaceGeometry { + u: GlobalPath::x_axis(), + v: Vector::unit_y(), + })); + let xz_plane = store.insert(Surface::new(SurfaceGeometry { + u: GlobalPath::x_axis(), + v: Vector::unit_z(), + })); + let yz_plane = store.insert(Surface::new(SurfaceGeometry { + u: GlobalPath::y_axis(), + v: Vector::unit_z(), + })); + + Self { + store, + xy_plane, + xz_plane, + yz_plane, + } + } +} + +/// Store for [`Vertex`] objects +#[derive(Debug, Default)] +pub struct Vertices { + store: Store, +} + +impl Vertices { + /// Insert a [`Vertex`] into the store + pub fn insert( + &self, + vertex: Vertex, + ) -> Result, VertexValidationError> { + vertex.validate()?; + Ok(self.store.insert(vertex)) + } +} diff --git a/crates/fj-kernel/src/storage/handle.rs b/crates/fj-kernel/src/storage/handle.rs index c4d169558..0ee3b9ec3 100644 --- a/crates/fj-kernel/src/storage/handle.rs +++ b/crates/fj-kernel/src/storage/handle.rs @@ -74,7 +74,7 @@ impl Deref for Handle { // which I've run successfully under Miri. let cell = unsafe { &*self.ptr }; - // Can only happen, if the object has been reserved, but the reservation + // Can only panic, if the object has been reserved, but the reservation // was never completed. cell.as_ref() .expect("Handle references non-existing object") diff --git a/crates/fj-kernel/src/storage/store.rs b/crates/fj-kernel/src/storage/store.rs index 27d94e53b..b00e85bd6 100644 --- a/crates/fj-kernel/src/storage/store.rs +++ b/crates/fj-kernel/src/storage/store.rs @@ -5,7 +5,7 @@ //! 1. No limitations on performance. //! 2. Best possible convenience. //! -//! Please note that I'm deliberately saving "no limitations" on performance. So +//! Please note that I'm deliberately saying "no limitations" on performance. So //! far, performance has not been a priority, so this might not be that fast. //! But by having a custom data structure, we should be able to make performance //! as good as we need it, within the limits of the practical.