pub trait Validate<T: ?Sized>:
'static
+ Send
+ Sync {
// Required methods
fn describe(&self, formatter: &mut Formatter<'_>) -> Result;
fn validate(&self, target: &T) -> Result<(), ErrorWithOrigin>;
}Expand description
Generic post-validation for a configuration parameter or a config.
§Implementations
Validations are implemented for the following types:
NotEmpty. Validates that a string or a collection, such asVec, is not empty.Range,RangeInclusiveetc. Validates whether the type is within the provided bounds.
Required Methods§
Trait Implementations§
Implementations on Foreign Types§
Source§impl<T> Validate<T> for RangeInclusive<T>
impl<T> Validate<T> for RangeInclusive<T>
Source§impl<T> Validate<T> for RangeToInclusive<T>
impl<T> Validate<T> for RangeToInclusive<T>
Source§impl<T: ?Sized, V: Validate<T> + ?Sized> Validate<T> for &'static V
Delegates via a reference. Useful for defining validation constants as &'static dyn Validate<_>.
impl<T: ?Sized, V: Validate<T> + ?Sized> Validate<T> for &'static V
Delegates via a reference. Useful for defining validation constants as &'static dyn Validate<_>.