form_validation/validation.rs
1use crate::ValidationErrors;
2
3/// A function/struct/item that can perform validation on an item with
4/// a given `Value` type.
5pub trait Validation<Value, Key> {
6 /// Validate a given form field referenced by a given `Key`, that
7 /// contains a given `Value`, returns
8 /// [ValidationErrors](ValidationErrors) if there are any.
9 fn validate_value(&self, value: &Value, key: &Key) -> Result<(), ValidationErrors<Key>>;
10}