Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Expect Instance in handle_model #2210

Merged
merged 1 commit into from
Feb 13, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions crates/fj/src/handle_model.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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};
Expand All @@ -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<M>(model: &M, services: Services) -> Result
pub fn handle_model<M>(model: &M, core: Instance) -> Result
where
for<'r> (&'r M, Tolerance): Triangulate,
M: BoundingVolume<3>,
Expand All @@ -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 {
Expand Down
2 changes: 1 addition & 1 deletion models/all/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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(())
}
2 changes: 1 addition & 1 deletion models/color/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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(())
}
2 changes: 1 addition & 1 deletion models/cuboid/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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(())
}
2 changes: 1 addition & 1 deletion models/holes/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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(())
}
2 changes: 1 addition & 1 deletion models/spacer/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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(())
}
2 changes: 1 addition & 1 deletion models/split/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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(())
}
2 changes: 1 addition & 1 deletion models/star/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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(())
}
2 changes: 1 addition & 1 deletion models/vertices-indices/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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(())
}