mirror of https://github.com/hannobraun/Fornjot
Add `FaceValidationError`
This commit is contained in:
parent
fed6533f54
commit
8eb974b225
|
@ -103,7 +103,7 @@ use crate::{
|
|||
path::GlobalPath,
|
||||
storage::{Handle, Store},
|
||||
validate::{
|
||||
CycleValidationError, HalfEdgeValidationError,
|
||||
CycleValidationError, FaceValidationError, HalfEdgeValidationError,
|
||||
SurfaceVertexValidationError, Validate2, VertexValidationError,
|
||||
},
|
||||
};
|
||||
|
@ -204,7 +204,10 @@ pub struct Faces {
|
|||
|
||||
impl Faces {
|
||||
/// Insert a [`Face`] into the store
|
||||
pub fn insert(&self, face: Face) -> Result<Handle<Face>, Infallible> {
|
||||
pub fn insert(
|
||||
&self,
|
||||
face: Face,
|
||||
) -> Result<Handle<Face>, FaceValidationError> {
|
||||
face.validate()?;
|
||||
Ok(self.store.insert(face))
|
||||
}
|
||||
|
|
|
@ -1,11 +1,9 @@
|
|||
use std::convert::Infallible;
|
||||
|
||||
use crate::objects::Face;
|
||||
|
||||
use super::{Validate2, ValidationConfig};
|
||||
|
||||
impl Validate2 for Face {
|
||||
type Error = Infallible;
|
||||
type Error = FaceValidationError;
|
||||
|
||||
fn validate_with_config(
|
||||
&self,
|
||||
|
@ -14,3 +12,7 @@ impl Validate2 for Face {
|
|||
Ok(())
|
||||
}
|
||||
}
|
||||
|
||||
/// [`Face`] validation error
|
||||
#[derive(Debug, thiserror::Error)]
|
||||
pub enum FaceValidationError {}
|
||||
|
|
|
@ -28,6 +28,7 @@ mod vertex;
|
|||
pub use self::{
|
||||
cycle::CycleValidationError,
|
||||
edge::HalfEdgeValidationError,
|
||||
face::FaceValidationError,
|
||||
uniqueness::UniquenessIssues,
|
||||
vertex::{SurfaceVertexValidationError, VertexValidationError},
|
||||
};
|
||||
|
@ -182,6 +183,10 @@ pub enum ValidationError {
|
|||
#[error(transparent)]
|
||||
Cycle(#[from] CycleValidationError),
|
||||
|
||||
/// `Face` validation error
|
||||
#[error(transparent)]
|
||||
Face(#[from] FaceValidationError),
|
||||
|
||||
/// `HalfEdge` validation error
|
||||
#[error(transparent)]
|
||||
HalfEdge(#[from] HalfEdgeValidationError),
|
||||
|
|
Loading…
Reference in New Issue