From 9b679aa841869d77d8eff5cba190cd9f3d7fb6d4 Mon Sep 17 00:00:00 2001 From: Hanno Braun Date: Tue, 13 Feb 2024 10:30:45 +0100 Subject: [PATCH] Expect `Instance` in `handle_model` That might have been the last place to use `Services` directly. --- crates/fj/src/handle_model.rs | 8 ++++---- models/all/src/main.rs | 2 +- models/color/src/main.rs | 2 +- models/cuboid/src/main.rs | 2 +- models/holes/src/main.rs | 2 +- models/spacer/src/main.rs | 2 +- models/split/src/main.rs | 2 +- models/star/src/main.rs | 2 +- models/vertices-indices/src/main.rs | 2 +- 9 files changed, 12 insertions(+), 12 deletions(-) diff --git a/crates/fj/src/handle_model.rs b/crates/fj/src/handle_model.rs index 7d8f1e1fb5..847fa598c8 100644 --- a/crates/fj/src/handle_model.rs +++ b/crates/fj/src/handle_model.rs @@ -6,8 +6,8 @@ use fj_core::{ bounding_volume::BoundingVolume, triangulate::Triangulate, }, - services::Services, validate::ValidationErrors, + Instance, }; use fj_interop::Model; use fj_math::{Aabb, Point, Scalar}; @@ -23,7 +23,7 @@ use crate::Args; /// /// This function is used by Fornjot's own testing infrastructure, but is useful /// beyond that, when using Fornjot directly to define a model. -pub fn handle_model(model: &M, services: Services) -> Result +pub fn handle_model(model: &M, core: Instance) -> Result where for<'r> (&'r M, Tolerance): Triangulate, M: BoundingVolume<3>, @@ -36,9 +36,9 @@ where let args = Args::parse(); if args.ignore_validation { - mem::forget(services); + mem::forget(core); } else { - services.drop_and_validate()?; + core.services.drop_and_validate()?; } let aabb = model.aabb().unwrap_or(Aabb { diff --git a/models/all/src/main.rs b/models/all/src/main.rs index c7f3746adf..767196187a 100644 --- a/models/all/src/main.rs +++ b/models/all/src/main.rs @@ -3,6 +3,6 @@ use fj::handle_model; fn main() -> fj::Result { let mut core = fj::core::Instance::new(); let model = all::model(&mut core); - handle_model(&model, core.services)?; + handle_model(&model, core)?; Ok(()) } diff --git a/models/color/src/main.rs b/models/color/src/main.rs index 845c2f79e7..909d527def 100644 --- a/models/color/src/main.rs +++ b/models/color/src/main.rs @@ -3,6 +3,6 @@ use fj::handle_model; fn main() -> fj::Result { let mut core = fj::core::Instance::new(); let model = color::model(&mut core); - handle_model(&model, core.services)?; + handle_model(&model, core)?; Ok(()) } diff --git a/models/cuboid/src/main.rs b/models/cuboid/src/main.rs index 9aa0752a75..290a2fbd6a 100644 --- a/models/cuboid/src/main.rs +++ b/models/cuboid/src/main.rs @@ -3,6 +3,6 @@ use fj::handle_model; fn main() -> fj::Result { let mut core = fj::core::Instance::new(); let model = cuboid::model([3., 2., 1.], &mut core); - handle_model(&model, core.services)?; + handle_model(&model, core)?; Ok(()) } diff --git a/models/holes/src/main.rs b/models/holes/src/main.rs index 984b3515b5..192b653971 100644 --- a/models/holes/src/main.rs +++ b/models/holes/src/main.rs @@ -3,6 +3,6 @@ use fj::handle_model; fn main() -> fj::Result { let mut core = fj::core::Instance::new(); let model = holes::model(0.25, &mut core); - handle_model(&model, core.services)?; + handle_model(&model, core)?; Ok(()) } diff --git a/models/spacer/src/main.rs b/models/spacer/src/main.rs index 4d8a3e3b2c..a6d19176ec 100644 --- a/models/spacer/src/main.rs +++ b/models/spacer/src/main.rs @@ -3,6 +3,6 @@ use fj::handle_model; fn main() -> fj::Result { let mut core = fj::core::Instance::new(); let model = spacer::model(1., 0.5, 1., &mut core); - handle_model(&model, core.services)?; + handle_model(&model, core)?; Ok(()) } diff --git a/models/split/src/main.rs b/models/split/src/main.rs index 52c9ca979b..7817bdbdaa 100644 --- a/models/split/src/main.rs +++ b/models/split/src/main.rs @@ -3,6 +3,6 @@ use fj::handle_model; fn main() -> fj::Result { let mut core = fj::core::Instance::new(); let model = split::model(1.0, 0.2, &mut core); - handle_model(&model, core.services)?; + handle_model(&model, core)?; Ok(()) } diff --git a/models/star/src/main.rs b/models/star/src/main.rs index 7318f7a091..cc8a8b2114 100644 --- a/models/star/src/main.rs +++ b/models/star/src/main.rs @@ -3,6 +3,6 @@ use fj::handle_model; fn main() -> fj::Result { let mut core = fj::core::Instance::new(); let model = star::model(5, 1., 2., 1., &mut core); - handle_model(&model, core.services)?; + handle_model(&model, core)?; Ok(()) } diff --git a/models/vertices-indices/src/main.rs b/models/vertices-indices/src/main.rs index 7b4550bf22..84d0b4bc07 100644 --- a/models/vertices-indices/src/main.rs +++ b/models/vertices-indices/src/main.rs @@ -3,6 +3,6 @@ use fj::handle_model; fn main() -> fj::Result { let mut core = fj::core::Instance::new(); let model = vertices_indices::model(&mut core); - handle_model(&model, core.services)?; + handle_model(&model, core)?; Ok(()) }