pub trait ValidationCheck<T>: Sized {
// Required method
fn check(
object: &T,
geometry: &Geometry,
config: &ValidationConfig,
) -> impl Iterator<Item = Self>;
// Provided methods
fn check_and_return_first_error(
object: &T,
geometry: &Geometry,
) -> Result<(), Self> { ... }
fn check_and_expect_one_error(object: &T, geometry: &Geometry) -> Self
where Self: Display { ... }
}
Expand description
Run a specific validation check on an object
This trait is implemented once per validation check and object it applies
to. Self
is the object, while T
identifies the validation check.
Required Methods§
Provided Methods§
Sourcefn check_and_return_first_error(
object: &T,
geometry: &Geometry,
) -> Result<(), Self>
fn check_and_return_first_error( object: &T, geometry: &Geometry, ) -> Result<(), Self>
Convenience method to run the check return the first error
This method is designed for convenience over flexibility (it is intended for use in unit tests), and thus always uses the default configuration.
Sourcefn check_and_expect_one_error(object: &T, geometry: &Geometry) -> Selfwhere
Self: Display,
fn check_and_expect_one_error(object: &T, geometry: &Geometry) -> Selfwhere
Self: Display,
Convenience method to run the check and expect one error
This method is designed for convenience over flexibility (it is intended for use in unit tests), and thus always uses the default configuration.
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.