[−][src]Struct semval::context::Context
A collection of invalidities resulting from a validation
Collects invalidities that are detected while performing a validation.
Methods
impl<V> Context<V> where
V: Invalidity,
[src]
V: Invalidity,
pub fn new() -> Self
[src]
Create a new valid and empty context
pub fn is_valid(&self) -> bool
[src]
Check if the context is still valid
pub fn invalidate(self, invalidity: impl Into<V>) -> Self
[src]
Record a new invalidity within this context
pub fn invalidate_if(
self,
is_invalid: impl Into<bool>,
invalidity: impl Into<V>
) -> Self
[src]
self,
is_invalid: impl Into<bool>,
invalidity: impl Into<V>
) -> Self
Conditionally record a new invalidity within this context
pub fn merge_result(self, res: Result<V>) -> Self
[src]
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,
[src]
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,
[src]
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>,
[src]
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,
[src]
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,
[src]
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
pub fn into_result(self) -> Result<V>
[src]
Finish the current validation of this context with a result
Trait Implementations
impl<V> Into<Result<(), Context<V>>> for Context<V> where
V: Invalidity,
[src]
V: Invalidity,
impl<V> IntoIterator for Context<V> where
V: Invalidity,
[src]
V: Invalidity,
Transform the validation context into an iterator that yields all the collected invalidities.
type Item = V
The type of the elements being iterated over.
type IntoIter = IntoIter<[V; 8]>
Which kind of iterator are we turning this into?
fn into_iter(self) -> Self::IntoIter
[src]
impl<V: Clone> Clone for Context<V> where
V: Invalidity,
[src]
V: Invalidity,
impl<V: Default> Default for Context<V> where
V: Invalidity,
[src]
V: Invalidity,
impl<V: Debug> Debug for Context<V> where
V: Invalidity,
[src]
V: Invalidity,
Auto Trait Implementations
impl<V> Send for Context<V> where
V: Send,
V: Send,
impl<V> Sync for Context<V> where
V: Sync,
V: Sync,
impl<V> Unpin for Context<V> where
V: Unpin,
V: Unpin,
impl<V> UnwindSafe for Context<V> where
V: RefUnwindSafe + UnwindSafe,
V: RefUnwindSafe + UnwindSafe,
impl<V> RefUnwindSafe for Context<V> where
V: RefUnwindSafe,
V: RefUnwindSafe,
Blanket Implementations
impl<V> Invalidity for V where
V: Any + Debug,
[src]
V: Any + Debug,
impl<T, V> IntoValidated<V> for T where
V: ValidatedFrom<T>,
[src]
V: ValidatedFrom<T>,
fn into_validated(Self) -> Result<V, (V, Context<<V as Validate>::Invalidity>)>
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T> From<T> for T
[src]
impl<I> IntoIterator for I where
I: Iterator,
[src]
I: Iterator,
type Item = <I as Iterator>::Item
The type of the elements being iterated over.
type IntoIter = I
Which kind of iterator are we turning this into?
fn into_iter(self) -> I
[src]
impl<T> ToOwned for T where
T: Clone,
[src]
T: Clone,
type Owned = T
The resulting type after obtaining ownership.
fn to_owned(&self) -> T
[src]
fn clone_into(&self, target: &mut T)
[src]
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = !
The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,
type Error = <U as TryFrom<T>>::Error
The type returned in the event of a conversion error.
fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>
[src]
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,