Struct semval::context::Context

source ·
pub struct Context<V>where
    V: Invalidity,
{ /* private fields */ }
Expand description

A collection of invalidities resulting from a validation

Collects invalidities that are detected while performing a validation.

Implementations

Create a new valid and empty context

Check if the context is still valid

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.

Merge the mapped results of another validation

Needed for collecting results from custom validation functions.

Validate the target and merge the result into this context

Validate the target and merge the mapped result into this context

Finish the validation

Finishes the current validation of this context with a result.

Errors

Returns Err with the collected invalidities if one or more validations failed.

Trait Implementations

Returns a copy of the value. Read more
Performs copy-assignment from source. Read more
Formats the value using the given formatter. Read more
Returns the “default value” for a type. Read more
Converts to this type from the input type.

Transform the validation context into an iterator that yields all the collected invalidities.

The type of the elements being iterated over.
Which kind of iterator are we turning this into?
Creates an iterator from a value. Read more

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more
Immutably borrows from an owned value. Read more
Mutably borrows from an owned value. Read more

Returns the argument unchanged.

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Convert self into output value and validate the output Read more
The resulting type after obtaining ownership.
Creates owned data from borrowed data, usually by cloning. Read more
Uses borrowed data to replace owned data, usually by cloning. Read more
The type returned in the event of a conversion error.
Performs the conversion.
The type returned in the event of a conversion error.
Performs the conversion.