Struct semval::context::Context [−][src]
pub struct Context<V> where
V: Invalidity, { /* fields omitted */ }
Expand description
A collection of invalidities resulting from a validation
Collects invalidities that are detected while performing a validation.
Implementations
Record a new invalidity within this context
Conditionally record a new invalidity within this context
Merge the results of another validation
Needed for collecting results from custom validation functions.
pub fn merge_result_with<F, U>(self, res: Result<U>, map: F) -> Self where
F: Fn(U) -> V,
U: Invalidity,
pub fn merge_result_with<F, U>(self, res: Result<U>, map: F) -> Self where
F: Fn(U) -> V,
U: Invalidity,
Merge the mapped results of another validation
Needed for collecting results from custom validation functions.
pub fn map_and_merge_result<F, U>(self, res: Result<U>, map: F) -> Self where
F: Fn(U) -> V,
U: Invalidity,
👎 Deprecated since 0.2.0: Please use merge_result_with
instead
pub fn map_and_merge_result<F, U>(self, res: Result<U>, map: F) -> Self where
F: Fn(U) -> V,
U: Invalidity,
Please use merge_result_with
instead
Merge the mapped results of another validation
pub fn validate<U>(self, target: &impl Validate<Invalidity = U>) -> Self where
U: Invalidity + Into<V>,
pub fn validate<U>(self, target: &impl Validate<Invalidity = U>) -> Self where
U: Invalidity + Into<V>,
Validate the target and merge the result into this context
pub fn validate_with<F, U>(
self,
target: &impl Validate<Invalidity = U>,
map: F
) -> Self where
F: Fn(U) -> V,
U: Invalidity,
pub fn validate_with<F, U>(
self,
target: &impl Validate<Invalidity = U>,
map: F
) -> Self where
F: Fn(U) -> V,
U: Invalidity,
Validate the target and merge the mapped result into this context
pub fn validate_and_map<F, U>(
self,
target: &impl Validate<Invalidity = U>,
map: F
) -> Self where
F: Fn(U) -> V,
U: Invalidity,
👎 Deprecated since 0.2.0: Please use validate_with
instead
pub fn validate_and_map<F, U>(
self,
target: &impl Validate<Invalidity = U>,
map: F
) -> Self where
F: Fn(U) -> V,
U: Invalidity,
Please use validate_with
instead
Validate the target, map the result, and merge it into this context
Finish the current validation of this context with a result
Trait Implementations
Transform the validation context into an iterator that yields all the collected invalidities.
Auto Trait Implementations
impl<V> RefUnwindSafe for Context<V> where
V: RefUnwindSafe,
impl<V> UnwindSafe for Context<V> where
V: UnwindSafe + RefUnwindSafe,
Blanket Implementations
Mutably borrows from an owned value. Read more
Convert self
into output value and validate the output