pub trait ValidateRange<T> {
// Required methods
fn greater_than(&self, max: T) -> Option<bool>;
fn less_than(&self, min: T) -> Option<bool>;
// Provided method
fn validate_range(
&self,
min: Option<T>,
max: Option<T>,
exclusive_min: Option<T>,
exclusive_max: Option<T>,
) -> bool { ... }
}Expand description
Validates that the given value is inside the defined range.
The max, min, exclusive_max and exclusive_min parameters are
optional and will only be validated if they are not None
Required Methods§
fn greater_than(&self, max: T) -> Option<bool>
fn less_than(&self, min: T) -> Option<bool>
Provided Methods§
fn validate_range( &self, min: Option<T>, max: Option<T>, exclusive_min: Option<T>, exclusive_max: Option<T>, ) -> bool
Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".