Skip to content

Commit

Permalink
Rename validation::Config to ValidationConfig
Browse files Browse the repository at this point in the history
The other types in that module don't rely on the module name for
disambiguation, so this is more consistent.
  • Loading branch information
hannobraun committed Jun 21, 2022
1 parent f3d8c29 commit fa5a62b
Show file tree
Hide file tree
Showing 9 changed files with 17 additions and 17 deletions.
16 changes: 8 additions & 8 deletions crates/fj-kernel/src/validation/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ use crate::{
/// Validate the given [`Shape`]
pub fn validate(
shape: Shape,
config: &Config,
config: &ValidationConfig,
) -> Result<Validated<Shape>, ValidationError> {
for edge in shape.edges() {
coherence::validate_edge(&edge.get(), config.identical_max_distance)?;
Expand All @@ -51,7 +51,7 @@ pub fn validate(

/// Configuration required for the validation process
#[derive(Debug, Clone, Copy)]
pub struct Config {
pub struct ValidationConfig {
/// The minimum distance between distinct objects
///
/// Objects whose distance is less than the value defined in this field, are
Expand All @@ -67,7 +67,7 @@ pub struct Config {
pub identical_max_distance: Scalar,
}

impl Default for Config {
impl Default for ValidationConfig {
fn default() -> Self {
Self {
distinct_min_distance: Scalar::from_f64(5e-7), // 0.5 µm,
Expand Down Expand Up @@ -183,7 +183,7 @@ mod tests {
use crate::{
objects::Edge,
shape::{LocalForm, Shape},
validation::Config,
validation::ValidationConfig,
};

#[test]
Expand Down Expand Up @@ -213,18 +213,18 @@ mod tests {

let result = super::validate(
shape.clone(),
&Config {
&ValidationConfig {
identical_max_distance: deviation * 2.,
..Config::default()
..ValidationConfig::default()
},
);
assert!(result.is_ok());

let result = super::validate(
shape,
&Config {
&ValidationConfig {
identical_max_distance: deviation / 2.,
..Config::default()
..ValidationConfig::default()
},
);
assert!(result.is_err());
Expand Down
2 changes: 1 addition & 1 deletion crates/fj-operations/src/circle.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ use super::ToShape;
impl ToShape for fj::Circle {
fn to_shape(
&self,
config: &validation::Config,
config: &validation::ValidationConfig,
_: Tolerance,
_: &mut DebugInfo,
) -> Result<Validated<Shape>, ValidationError> {
Expand Down
2 changes: 1 addition & 1 deletion crates/fj-operations/src/difference_2d.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ use super::ToShape;
impl ToShape for fj::Difference2d {
fn to_shape(
&self,
config: &validation::Config,
config: &validation::ValidationConfig,
tolerance: Tolerance,
debug_info: &mut DebugInfo,
) -> Result<Validated<Shape>, ValidationError> {
Expand Down
2 changes: 1 addition & 1 deletion crates/fj-operations/src/group.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ use super::ToShape;
impl ToShape for fj::Group {
fn to_shape(
&self,
config: &validation::Config,
config: &validation::ValidationConfig,
tolerance: Tolerance,
debug_info: &mut DebugInfo,
) -> Result<Validated<Shape>, ValidationError> {
Expand Down
4 changes: 2 additions & 2 deletions crates/fj-operations/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ pub trait ToShape {
/// Compute the boundary representation of the shape
fn to_shape(
&self,
config: &validation::Config,
config: &validation::ValidationConfig,
tolerance: Tolerance,
debug_info: &mut DebugInfo,
) -> Result<Validated<Shape>, ValidationError>;
Expand Down Expand Up @@ -91,7 +91,7 @@ macro_rules! dispatch {

dispatch! {
to_shape(
config: &validation::Config,
config: &validation::ValidationConfig,
tolerance: Tolerance,
debug_info: &mut DebugInfo,
) -> Result<Validated<Shape>, ValidationError>;
Expand Down
2 changes: 1 addition & 1 deletion crates/fj-operations/src/shape_processor.rs
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ impl ShapeProcessor {
Some(user_defined_tolerance) => user_defined_tolerance,
};

let config = validation::Config::default();
let config = validation::ValidationConfig::default();
let mut debug_info = DebugInfo::new();
let shape = shape.to_shape(&config, tolerance, &mut debug_info)?;
let mesh = triangulate(shape.into_inner(), tolerance, &mut debug_info);
Expand Down
2 changes: 1 addition & 1 deletion crates/fj-operations/src/sketch.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ use super::ToShape;
impl ToShape for fj::Sketch {
fn to_shape(
&self,
config: &validation::Config,
config: &validation::ValidationConfig,
_: Tolerance,
_: &mut DebugInfo,
) -> Result<Validated<Shape>, ValidationError> {
Expand Down
2 changes: 1 addition & 1 deletion crates/fj-operations/src/sweep.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ use super::ToShape;
impl ToShape for fj::Sweep {
fn to_shape(
&self,
config: &validation::Config,
config: &validation::ValidationConfig,
tolerance: Tolerance,
debug_info: &mut DebugInfo,
) -> Result<Validated<Shape>, ValidationError> {
Expand Down
2 changes: 1 addition & 1 deletion crates/fj-operations/src/transform.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ use super::ToShape;
impl ToShape for fj::Transform {
fn to_shape(
&self,
config: &validation::Config,
config: &validation::ValidationConfig,
tolerance: Tolerance,
debug_info: &mut DebugInfo,
) -> Result<Validated<Shape>, ValidationError> {
Expand Down

0 comments on commit fa5a62b

Please sign in to comment.