Trait smart_config::validation::Validate
source · 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
,RangeInclusive
etc. 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
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<_>
.