diff --git a/crates/fj-core/src/algorithms/approx/curve.rs b/crates/fj-core/src/algorithms/approx/curve.rs index 4a2bf0e7a5..d3fa3fc31d 100644 --- a/crates/fj-core/src/algorithms/approx/curve.rs +++ b/crates/fj-core/src/algorithms/approx/curve.rs @@ -192,7 +192,7 @@ mod tests { let (surface_path, boundary) = SurfacePath::line_from_points([[1., 1.], [2., 1.]]); let boundary = CurveBoundary::from(boundary); - let surface = core.services.objects.surfaces.xz_plane(); + let surface = core.layers.objects.surfaces.xz_plane(); let tolerance = 1.; let approx = @@ -263,7 +263,7 @@ mod tests { let surface_path = SurfacePath::circle_from_center_and_radius([0., 0.], 1.); let boundary = CurveBoundary::from([[0.], [TAU]]); - let surface = core.services.objects.surfaces.xz_plane(); + let surface = core.layers.objects.surfaces.xz_plane(); let tolerance = 1.; let approx = diff --git a/crates/fj-core/src/algorithms/intersect/curve_face.rs b/crates/fj-core/src/algorithms/intersect/curve_face.rs index 4c2dc2d908..dc5472a42e 100644 --- a/crates/fj-core/src/algorithms/intersect/curve_face.rs +++ b/crates/fj-core/src/algorithms/intersect/curve_face.rs @@ -186,7 +186,7 @@ mod tests { ]; let face = - Face::unbound(core.services.objects.surfaces.xy_plane(), &mut core) + Face::unbound(core.layers.objects.surfaces.xy_plane(), &mut core) .update_region( |region, core| { region diff --git a/crates/fj-core/src/algorithms/intersect/face_face.rs b/crates/fj-core/src/algorithms/intersect/face_face.rs index b818ee6ac4..da459655f9 100644 --- a/crates/fj-core/src/algorithms/intersect/face_face.rs +++ b/crates/fj-core/src/algorithms/intersect/face_face.rs @@ -85,8 +85,8 @@ mod tests { [1., 2.], ]; let [a, b] = [ - core.services.objects.surfaces.xy_plane(), - core.services.objects.surfaces.xz_plane(), + core.layers.objects.surfaces.xy_plane(), + core.layers.objects.surfaces.xz_plane(), ] .map(|surface| { Face::unbound(surface, &mut core).update_region( @@ -116,8 +116,8 @@ mod tests { [-1., 1.], ]; let surfaces = [ - core.services.objects.surfaces.xy_plane(), - core.services.objects.surfaces.xz_plane(), + core.layers.objects.surfaces.xy_plane(), + core.layers.objects.surfaces.xz_plane(), ]; let [a, b] = surfaces.clone().map(|surface| { Face::unbound(surface, &mut core).update_region( diff --git a/crates/fj-core/src/algorithms/intersect/face_point.rs b/crates/fj-core/src/algorithms/intersect/face_point.rs index 06d9ae95d3..38a98a1a29 100644 --- a/crates/fj-core/src/algorithms/intersect/face_point.rs +++ b/crates/fj-core/src/algorithms/intersect/face_point.rs @@ -148,7 +148,7 @@ mod tests { let mut core = Instance::new(); let face = - Face::unbound(core.services.objects.surfaces.xy_plane(), &mut core) + Face::unbound(core.layers.objects.surfaces.xy_plane(), &mut core) .update_region( |region, core| { region.update_exterior( @@ -174,7 +174,7 @@ mod tests { let mut core = Instance::new(); let face = - Face::unbound(core.services.objects.surfaces.xy_plane(), &mut core) + Face::unbound(core.layers.objects.surfaces.xy_plane(), &mut core) .update_region( |region, core| { region.update_exterior( @@ -203,7 +203,7 @@ mod tests { let mut core = Instance::new(); let face = - Face::unbound(core.services.objects.surfaces.xy_plane(), &mut core) + Face::unbound(core.layers.objects.surfaces.xy_plane(), &mut core) .update_region( |region, core| { region.update_exterior( @@ -232,7 +232,7 @@ mod tests { let mut core = Instance::new(); let face = - Face::unbound(core.services.objects.surfaces.xy_plane(), &mut core) + Face::unbound(core.layers.objects.surfaces.xy_plane(), &mut core) .update_region( |region, core| { region.update_exterior( @@ -261,7 +261,7 @@ mod tests { let mut core = Instance::new(); let face = - Face::unbound(core.services.objects.surfaces.xy_plane(), &mut core) + Face::unbound(core.layers.objects.surfaces.xy_plane(), &mut core) .update_region( |region, core| { region.update_exterior( @@ -290,7 +290,7 @@ mod tests { let mut core = Instance::new(); let face = - Face::unbound(core.services.objects.surfaces.xy_plane(), &mut core) + Face::unbound(core.layers.objects.surfaces.xy_plane(), &mut core) .update_region( |region, core| { region.update_exterior( @@ -325,7 +325,7 @@ mod tests { let mut core = Instance::new(); let face = - Face::unbound(core.services.objects.surfaces.xy_plane(), &mut core) + Face::unbound(core.layers.objects.surfaces.xy_plane(), &mut core) .update_region( |region, core| { region.update_exterior( @@ -362,7 +362,7 @@ mod tests { let mut core = Instance::new(); let face = - Face::unbound(core.services.objects.surfaces.xy_plane(), &mut core) + Face::unbound(core.layers.objects.surfaces.xy_plane(), &mut core) .update_region( |region, core| { region.update_exterior( diff --git a/crates/fj-core/src/algorithms/intersect/ray_face.rs b/crates/fj-core/src/algorithms/intersect/ray_face.rs index 741213b68c..4b62b1f03f 100644 --- a/crates/fj-core/src/algorithms/intersect/ray_face.rs +++ b/crates/fj-core/src/algorithms/intersect/ray_face.rs @@ -164,7 +164,7 @@ mod tests { let ray = HorizontalRayToTheRight::from([0., 0., 0.]); let face = - Face::unbound(core.services.objects.surfaces.yz_plane(), &mut core) + Face::unbound(core.layers.objects.surfaces.yz_plane(), &mut core) .update_region( |region, core| { region.update_exterior( @@ -196,7 +196,7 @@ mod tests { let ray = HorizontalRayToTheRight::from([0., 0., 0.]); let face = - Face::unbound(core.services.objects.surfaces.yz_plane(), &mut core) + Face::unbound(core.layers.objects.surfaces.yz_plane(), &mut core) .update_region( |region, core| { region.update_exterior( @@ -231,7 +231,7 @@ mod tests { let ray = HorizontalRayToTheRight::from([0., 0., 0.]); let face = - Face::unbound(core.services.objects.surfaces.yz_plane(), &mut core) + Face::unbound(core.layers.objects.surfaces.yz_plane(), &mut core) .update_region( |region, core| { region.update_exterior( @@ -263,7 +263,7 @@ mod tests { let ray = HorizontalRayToTheRight::from([0., 0., 0.]); let face = - Face::unbound(core.services.objects.surfaces.yz_plane(), &mut core) + Face::unbound(core.layers.objects.surfaces.yz_plane(), &mut core) .update_region( |region, core| { region.update_exterior( @@ -305,7 +305,7 @@ mod tests { let ray = HorizontalRayToTheRight::from([0., 0., 0.]); let face = - Face::unbound(core.services.objects.surfaces.yz_plane(), &mut core) + Face::unbound(core.layers.objects.surfaces.yz_plane(), &mut core) .update_region( |region, core| { region.update_exterior( @@ -348,7 +348,7 @@ mod tests { let ray = HorizontalRayToTheRight::from([0., 0., 0.]); let face = - Face::unbound(core.services.objects.surfaces.xy_plane(), &mut core) + Face::unbound(core.layers.objects.surfaces.xy_plane(), &mut core) .update_region( |region, core| { region.update_exterior( @@ -382,7 +382,7 @@ mod tests { let ray = HorizontalRayToTheRight::from([0., 0., 0.]); let face = - Face::unbound(core.services.objects.surfaces.xy_plane(), &mut core) + Face::unbound(core.layers.objects.surfaces.xy_plane(), &mut core) .update_region( |region, core| { region.update_exterior( diff --git a/crates/fj-core/src/algorithms/intersect/surface_surface.rs b/crates/fj-core/src/algorithms/intersect/surface_surface.rs index 2b77545ac5..edf2bf724b 100644 --- a/crates/fj-core/src/algorithms/intersect/surface_surface.rs +++ b/crates/fj-core/src/algorithms/intersect/surface_surface.rs @@ -85,8 +85,8 @@ mod tests { fn plane_plane() { let mut core = Instance::new(); - let xy = core.services.objects.surfaces.xy_plane(); - let xz = core.services.objects.surfaces.xz_plane(); + let xy = core.layers.objects.surfaces.xy_plane(); + let xz = core.layers.objects.surfaces.xz_plane(); // Coincident and parallel planes don't have an intersection curve. assert_eq!( diff --git a/crates/fj-core/src/algorithms/triangulate/mod.rs b/crates/fj-core/src/algorithms/triangulate/mod.rs index e2c8bcc1dd..653fe89bc3 100644 --- a/crates/fj-core/src/algorithms/triangulate/mod.rs +++ b/crates/fj-core/src/algorithms/triangulate/mod.rs @@ -99,7 +99,7 @@ mod tests { let d = [0., 1.]; let face = - Face::unbound(core.services.objects.surfaces.xy_plane(), &mut core) + Face::unbound(core.layers.objects.surfaces.xy_plane(), &mut core) .update_region( |region, core| { region.update_exterior( @@ -139,7 +139,7 @@ mod tests { let g = [3., 3.]; let h = [3., 1.]; - let surface = core.services.objects.surfaces.xy_plane(); + let surface = core.layers.objects.surfaces.xy_plane(); let face = Face::unbound(surface.clone(), &mut core).update_region( |region, core| { @@ -204,7 +204,7 @@ mod tests { let d = [1., 1.]; let e = [0., 9.]; - let surface = core.services.objects.surfaces.xy_plane(); + let surface = core.layers.objects.surfaces.xy_plane(); let face = Face::unbound(surface.clone(), &mut core).update_region( |region, core| { diff --git a/crates/fj-core/src/instance.rs b/crates/fj-core/src/instance.rs index 975e640814..e6f653289f 100644 --- a/crates/fj-core/src/instance.rs +++ b/crates/fj-core/src/instance.rs @@ -2,27 +2,27 @@ //! //! See [`Instance`]. -use crate::{services::Services, validate::ValidationConfig}; +use crate::{layers::Layers, validate::ValidationConfig}; /// An instance of the Fornjot core /// /// This is the main entry point to `fj-core`'s API. pub struct Instance { - /// Event-sourced background services - pub services: Services, + /// The layers of data that make up the state of a core instance + pub layers: Layers, } impl Instance { /// Construct an instance of `Instance` pub fn new() -> Self { - let services = Services::new(); - Self { services } + let layers = Layers::new(); + Self { layers } } /// Construct an instance of `Instance`, using the provided configuration pub fn with_validation_config(config: ValidationConfig) -> Self { - let services = Services::with_validation_config(config); - Self { services } + let layers = Layers::with_validation_config(config); + Self { layers } } } diff --git a/crates/fj-core/src/services/service.rs b/crates/fj-core/src/layers/layer.rs similarity index 51% rename from crates/fj-core/src/services/service.rs rename to crates/fj-core/src/layers/layer.rs index 76471e8dab..efa1efcbeb 100644 --- a/crates/fj-core/src/services/service.rs +++ b/crates/fj-core/src/layers/layer.rs @@ -1,38 +1,35 @@ use std::ops::Deref; -/// A service that controls access to some state +/// A generic layer, which controls access to layer state /// -/// `Service` is a generic wrapper around some state, as well as code that knows -/// how to operate on that state. It processes commands, changes the state based -/// on those command, and produces events that capture these changes. These -/// events are stored, providing a log of all changes to the state, and can be -/// replayed later to re-create the state at any point in time. +/// `Layer` is a generic wrapper around some state and controls access to it. It +/// [`Deref`]s to the state it wraps, for easy read access, but prevents any +/// direct write access. /// -/// The wrapped state must implement [`State`], which defines the type of -/// command that this service processes, and the type of event that captures -/// state changes. It also defines methods that operate on the state, commands, -/// and events. +/// Instead, each write access to state is reified as a command, which are +/// processed by [`Layer::process`]. Processing a command can result in any +/// number of events, which can then be used as commands for other layers. /// -/// Implementations of [`State`] might also define an extension trait for a -/// specific `Service`, to provide a convenient API to callers. +/// All of this is mediated through [`State`], which the wrapped state must +/// implement. /// /// This design takes inspiration from, and uses the nomenclature of, this /// article: /// -pub struct Service { +pub struct Layer { state: S, } -impl Service { - /// Create an instance of `Service` +impl Layer { + /// Create an instance of `Layer` pub fn new(state: S) -> Self { Self { state } } - /// Execute a command + /// Process a command /// - /// The command is executed synchronously. When this method returns, the - /// state has been updated and any events have been logged. + /// The command is processed synchronously. When this method returns, the + /// state has been updated. pub fn process(&mut self, command: S::Command, events: &mut Vec) { self.state.decide(command, events); @@ -47,7 +44,7 @@ impl Service { } } -impl Deref for Service { +impl Deref for Layer { type Target = S; fn deref(&self) -> &Self::Target { @@ -55,7 +52,7 @@ impl Deref for Service { } } -impl Default for Service +impl Default for Layer where S: Default, { @@ -64,16 +61,19 @@ where } } -/// Implemented for state that can be wrapped by a [`Service`] +/// The state of a specific layer /// -/// See [`Service`] for a detailed explanation. +/// Implementations of this trait are wrapped by the generic [`Layer`], which is +/// the consumer of this trait's API. +/// +/// See [`Layer`] for a more detailed explanation. pub trait State { - /// A command that relates to the state + /// A command that encodes a request to update the state /// /// Commands are processed by [`State::decide`]. type Command; - /// An event that captures modifications to this state + /// An event that encodes a change to the state /// /// Events are produced by [`State::decide`] and processed by /// [`State::evolve`]. @@ -87,8 +87,8 @@ pub trait State { /// Evolve the state according to the provided event /// - /// This is the only method gets mutable access to the state, making sure - /// that all changes to the state are captured as events. + /// This is the only method that gets mutable access to the state, making + /// sure that all changes to the state are captured as events. /// /// Implementations of this method are supposed to be relatively dumb. Any /// decisions that go into updating the state should be made in diff --git a/crates/fj-core/src/layers/mod.rs b/crates/fj-core/src/layers/mod.rs new file mode 100644 index 0000000000..780f1a15a8 --- /dev/null +++ b/crates/fj-core/src/layers/mod.rs @@ -0,0 +1,89 @@ +//! Loosely coupled layers, that together define shapes +//! +//! See [`Layers`]. + +mod layer; +mod objects; +mod validation; + +use crate::{ + objects::{AboutToBeStored, AnyObject, Objects}, + validate::{ValidationConfig, ValidationErrors}, +}; + +pub use self::{ + layer::{Layer, State}, + objects::{InsertObject, Operation}, + validation::{Validation, ValidationCommand, ValidationEvent}, +}; + +/// # Loosely coupled layers, that together define shapes +/// +/// Shapes are not a monolithic thing in Fornjot, but instead are defined by +/// several, loosely coupled layers. These layers are owned by this struct. +/// +/// ## Implementation Note +/// +/// It is totally conceivable that one day, this system of layers is extensible +/// and more layers can be defined by third-party code. The foundation for that, +/// the loose coupling and inter-layer communication via events, is already +/// there, conceptually. +/// +/// For now, there is no need for this, and all layers are just hardcoded here. +/// That can be changed, once necessary. +#[derive(Default)] +pub struct Layers { + /// The objects layers + /// + /// Manages the stores of topological and geometric objects that make up + /// shapes. + pub objects: Layer, + + /// The validation layer + /// + /// Monitors objects and validates them, as they are inserted. + pub validation: Layer, +} + +impl Layers { + /// Construct an instance of `Layers` + pub fn new() -> Self { + Self::default() + } + + /// Construct an instance of `Layers`, using the provided configuration + pub fn with_validation_config(config: ValidationConfig) -> Self { + let objects = Layer::default(); + let validation = Layer::new(Validation::with_validation_config(config)); + + Self { + objects, + validation, + } + } + + /// Insert an object into the stores + pub fn insert_object(&mut self, object: AnyObject) { + let mut object_events = Vec::new(); + self.objects + .process(Operation::InsertObject { object }, &mut object_events); + + for object_event in object_events { + let command = ValidationCommand::ValidateObject { + object: object_event.object.into(), + }; + self.validation.process(command, &mut Vec::new()); + } + } + + /// Drop `Layers`; return any unhandled validation error + pub fn drop_and_validate(self) -> Result<(), ValidationErrors> { + let errors = self.validation.into_state().into_errors(); + + if errors.0.is_empty() { + Ok(()) + } else { + Err(errors) + } + } +} diff --git a/crates/fj-core/src/services/objects.rs b/crates/fj-core/src/layers/objects.rs similarity index 91% rename from crates/fj-core/src/services/objects.rs rename to crates/fj-core/src/layers/objects.rs index 745432627b..916a7ff130 100644 --- a/crates/fj-core/src/services/objects.rs +++ b/crates/fj-core/src/layers/objects.rs @@ -16,7 +16,7 @@ impl State for Objects { } } -/// Command for `Service` +/// Command for `Layer` #[derive(Debug)] pub enum Operation { /// Insert an object into the stores @@ -29,7 +29,7 @@ pub enum Operation { }, } -/// Event produced by `Service` +/// Event produced by `Layer` #[derive(Clone, Debug)] pub struct InsertObject { /// The object to insert diff --git a/crates/fj-core/src/services/validation.rs b/crates/fj-core/src/layers/validation.rs similarity index 93% rename from crates/fj-core/src/services/validation.rs rename to crates/fj-core/src/layers/validation.rs index 0c41e492da..a9e28bb254 100644 --- a/crates/fj-core/src/services/validation.rs +++ b/crates/fj-core/src/layers/validation.rs @@ -19,7 +19,7 @@ pub struct Validation { } impl Validation { - /// A constructor for the validation service that allows a validation configuration to be set for the service + /// Construct an instance of `Validation`, using the provided configuration pub fn with_validation_config(config: ValidationConfig) -> Self { let errors = HashMap::new(); Self { errors, config } @@ -91,7 +91,7 @@ impl State for Validation { } } -/// The command accepted by the validation service +/// Command for `Layer` pub enum ValidationCommand { /// Validate the provided object ValidateObject { @@ -100,7 +100,7 @@ pub enum ValidationCommand { }, } -/// The event produced by the validation service +/// Event produced by `Layer` #[derive(Clone)] pub enum ValidationEvent { /// Validation of an object failed diff --git a/crates/fj-core/src/lib.rs b/crates/fj-core/src/lib.rs index a5e8032184..5f87b5489f 100644 --- a/crates/fj-core/src/lib.rs +++ b/crates/fj-core/src/lib.rs @@ -83,10 +83,10 @@ pub mod algorithms; pub mod geometry; +pub mod layers; pub mod objects; pub mod operations; pub mod queries; -pub mod services; pub mod storage; pub mod validate; diff --git a/crates/fj-core/src/operations/insert/insert_trait.rs b/crates/fj-core/src/operations/insert/insert_trait.rs index 83b5c33475..1e683a1c36 100644 --- a/crates/fj-core/src/operations/insert/insert_trait.rs +++ b/crates/fj-core/src/operations/insert/insert_trait.rs @@ -38,9 +38,9 @@ macro_rules! impl_insert { type Inserted = Handle; fn insert(self, core: &mut Instance) -> Self::Inserted { - let handle = core.services.objects.$store.reserve(); + let handle = core.layers.objects.$store.reserve(); let object = (handle.clone(), self).into(); - core.services.insert_object(object); + core.layers.insert_object(object); handle } } diff --git a/crates/fj-core/src/services/mod.rs b/crates/fj-core/src/services/mod.rs deleted file mode 100644 index 892bfb881c..0000000000 --- a/crates/fj-core/src/services/mod.rs +++ /dev/null @@ -1,76 +0,0 @@ -//! Service API that promotes monitoring and interactivity -//! -//! See [`Service`]. - -mod objects; -mod service; -mod validation; - -use crate::{ - objects::{AboutToBeStored, AnyObject, Objects}, - validate::{ValidationConfig, ValidationErrors}, -}; - -pub use self::{ - objects::{InsertObject, Operation}, - service::{Service, State}, - validation::{Validation, ValidationCommand, ValidationEvent}, -}; - -/// The kernel services -#[derive(Default)] -pub struct Services { - /// The objects service - /// - /// Allows for inserting objects into a store after they were created. - pub objects: Service, - - /// The validation service - /// - /// Validates objects that are inserted using the objects service. - pub validation: Service, -} - -impl Services { - /// Construct an instance of `Services` - pub fn new() -> Self { - Self::default() - } - - /// Construct an instance of `Services`, using the provided configuration - pub fn with_validation_config(config: ValidationConfig) -> Self { - let objects = Service::default(); - let validation = - Service::new(Validation::with_validation_config(config)); - - Self { - objects, - validation, - } - } - - /// Insert an object into the stores - pub fn insert_object(&mut self, object: AnyObject) { - let mut object_events = Vec::new(); - self.objects - .process(Operation::InsertObject { object }, &mut object_events); - - for object_event in object_events { - let command = ValidationCommand::ValidateObject { - object: object_event.object.into(), - }; - self.validation.process(command, &mut Vec::new()); - } - } - - /// Drop `Services`; return any unhandled validation error - pub fn drop_and_validate(self) -> Result<(), ValidationErrors> { - let errors = self.validation.into_state().into_errors(); - - if errors.0.is_empty() { - Ok(()) - } else { - Err(errors) - } - } -} diff --git a/crates/fj-core/src/validate/face.rs b/crates/fj-core/src/validate/face.rs index 65168b0979..180c02d5b4 100644 --- a/crates/fj-core/src/validate/face.rs +++ b/crates/fj-core/src/validate/face.rs @@ -102,7 +102,7 @@ mod tests { let mut core = Instance::new(); let invalid = - Face::unbound(core.services.objects.surfaces.xy_plane(), &mut core); + Face::unbound(core.layers.objects.surfaces.xy_plane(), &mut core); let valid = invalid.update_region( |region, core| { region.update_exterior( @@ -132,7 +132,7 @@ mod tests { let mut core = Instance::new(); let valid = - Face::unbound(core.services.objects.surfaces.xy_plane(), &mut core) + Face::unbound(core.layers.objects.surfaces.xy_plane(), &mut core) .update_region( |region, core| { region diff --git a/crates/fj-core/src/validate/mod.rs b/crates/fj-core/src/validate/mod.rs index 869b25d817..9a03744585 100644 --- a/crates/fj-core/src/validate/mod.rs +++ b/crates/fj-core/src/validate/mod.rs @@ -40,10 +40,10 @@ //! validation errors are collected in the background, to be processed when the //! whole shape has been finished. //! -//! This is set up within the [`Services`] API, and validation errors result in -//! a panic, when the [`Services`] instance is dropped. Unless you want to -//! handle validation errors in a different way, you don't have to do anything -//! special to use the validation infrastructure. +//! This is set up within the [`Layers`] API, and validation errors result in a +//! panic, when the [`Layers`] instance is dropped. Unless you want to handle +//! validation errors in a different way, you don't have to do anything special +//! to use the validation infrastructure. //! //! //! ## Configuration @@ -62,7 +62,7 @@ //! //! [`fj-export`]: https://crates.io/crates/fj-export //! [issue tracker]: https://github.com/hannobraun/fornjot/issues -//! [`Services`]: crate::services::Services +//! [`Layers`]: crate::layers::Layers mod curve; mod cycle; diff --git a/crates/fj-core/src/validate/solid.rs b/crates/fj-core/src/validate/solid.rs index 6ab5c17696..21180e9924 100644 --- a/crates/fj-core/src/validate/solid.rs +++ b/crates/fj-core/src/validate/solid.rs @@ -236,7 +236,7 @@ mod tests { valid_solid.validate_and_return_first_error()?; // Ignore remaining validation errors. - let _ = core.services.drop_and_validate(); + let _ = core.layers.drop_and_validate(); Ok(()) } @@ -289,7 +289,7 @@ mod tests { valid_solid.validate_and_return_first_error()?; // Ignore remaining validation errors. - let _ = core.services.drop_and_validate(); + let _ = core.layers.drop_and_validate(); Ok(()) } @@ -339,7 +339,7 @@ mod tests { valid_solid.validate_and_return_first_error()?; // Ignore remaining validation errors. - let _ = core.services.drop_and_validate(); + let _ = core.layers.drop_and_validate(); Ok(()) } @@ -379,7 +379,7 @@ mod tests { valid_solid.validate_and_return_first_error()?; // Ignore remaining validation errors. - let _ = core.services.drop_and_validate(); + let _ = core.layers.drop_and_validate(); Ok(()) } diff --git a/crates/fj/src/handle_model.rs b/crates/fj/src/handle_model.rs index 847fa598c8..e029221f13 100644 --- a/crates/fj/src/handle_model.rs +++ b/crates/fj/src/handle_model.rs @@ -38,7 +38,7 @@ where if args.ignore_validation { mem::forget(core); } else { - core.services.drop_and_validate()?; + core.layers.drop_and_validate()?; } let aabb = model.aabb().unwrap_or(Aabb { diff --git a/models/cuboid/src/lib.rs b/models/cuboid/src/lib.rs index 5e614a3ac0..047d04dd16 100644 --- a/models/cuboid/src/lib.rs +++ b/models/cuboid/src/lib.rs @@ -16,7 +16,7 @@ pub fn model( ) -> Solid { let [x, y, z] = size.into().components; - let bottom_surface = core.services.objects.surfaces.xy_plane(); + let bottom_surface = core.layers.objects.surfaces.xy_plane(); let sweep_path = Vector::from([Scalar::ZERO, Scalar::ZERO, z]); Sketch::empty() diff --git a/models/spacer/src/lib.rs b/models/spacer/src/lib.rs index baf0bf611a..2a58de1302 100644 --- a/models/spacer/src/lib.rs +++ b/models/spacer/src/lib.rs @@ -17,7 +17,7 @@ pub fn model( height: f64, core: &mut fj::core::Instance, ) -> Solid { - let bottom_surface = core.services.objects.surfaces.xy_plane(); + let bottom_surface = core.layers.objects.surfaces.xy_plane(); let sweep_path = Vector::from([0., 0., height]); Sketch::empty() diff --git a/models/star/src/lib.rs b/models/star/src/lib.rs index 4cf106ad6e..295d03e169 100644 --- a/models/star/src/lib.rs +++ b/models/star/src/lib.rs @@ -40,7 +40,7 @@ pub fn model( inner_points.push([x / 2., y / 2.]); } - let bottom_surface = core.services.objects.surfaces.xy_plane(); + let bottom_surface = core.layers.objects.surfaces.xy_plane(); let sweep_path = Vector::from([0., 0., h]); Sketch::empty()