diff --git a/crates/fj-kernel/src/validate/mod.rs b/crates/fj-kernel/src/validate/mod.rs index 953c5a43d..4b4c94d9f 100644 --- a/crates/fj-kernel/src/validate/mod.rs +++ b/crates/fj-kernel/src/validate/mod.rs @@ -31,62 +31,10 @@ pub use self::{ vertex::{SurfaceVertexValidationError, VertexValidationError}, }; -use std::{convert::Infallible, ops::Deref}; +use std::convert::Infallible; use fj_math::Scalar; -use crate::iter::ObjectIters; - -/// Validate an object -pub trait Validate: Sized { - /// Validate the object using default configuration - /// - /// The following calls are equivalent: - /// ``` rust - /// # use fj_kernel::{ - /// # objects::{GlobalVertex, Objects}, - /// # validate::{Validate, ValidationConfig}, - /// # }; - /// # let objects = Objects::new(); - /// # let object = objects.global_vertices.insert( - /// # GlobalVertex::from_position([0., 0., 0.]) - /// # ); - /// object.validate(); - /// ``` - /// ``` rust - /// # use fj_kernel::{ - /// # objects::{GlobalVertex, Objects}, - /// # validate::{Validate, ValidationConfig}, - /// # }; - /// # let objects = Objects::new(); - /// # let object = objects.global_vertices.insert( - /// # GlobalVertex::from_position([0., 0., 0.]) - /// # ); - /// object.validate_with_config(&ValidationConfig::default()); - /// ``` - fn validate(self) -> Result, ValidationError> { - self.validate_with_config(&ValidationConfig::default()) - } - - /// Validate the object - fn validate_with_config( - self, - config: &ValidationConfig, - ) -> Result, ValidationError>; -} - -impl Validate for T -where - T: for<'r> ObjectIters<'r>, -{ - fn validate_with_config( - self, - _: &ValidationConfig, - ) -> Result, ValidationError> { - Ok(Validated(self)) - } -} - /// Validate an object pub trait Validate2: Sized { /// The error that validation of the implementing type can result in @@ -136,27 +84,6 @@ impl Default for ValidationConfig { } } -/// Wrapper around an object that indicates the object has been validated -/// -/// Returned by implementations of `Validate`. -#[derive(Clone, Copy, Debug, Eq, PartialEq, Hash, Ord, PartialOrd)] -pub struct Validated(T); - -impl Validated { - /// Consume this instance of `Validated` and return the wrapped object - pub fn into_inner(self) -> T { - self.0 - } -} - -impl Deref for Validated { - type Target = T; - - fn deref(&self) -> &Self::Target { - &self.0 - } -} - /// An error that can occur during a validation #[allow(clippy::large_enum_variant)] #[derive(Debug, thiserror::Error)]