[−][src]Struct semval::context::Context
A collection of violations resulting from a validation
Collects violations that are detected while performing a validation.
Methods
impl<V> Context<V> where
V: Validation,
[src]
V: Validation,
pub fn violations(&self) -> impl Iterator<Item = &V>
[src]
The violations collected so far
pub fn has_violations(&self) -> bool
[src]
Check if the context already has any violations
pub fn count_violations(&self) -> usize
[src]
Count the number of violations collected so far
pub fn add_violation(&mut self, violation: impl Into<V>)
[src]
Add a new violation to the context
pub fn merge_result(&mut self, res: Result<V>)
[src]
Merge a validation result into the context
pub fn map_and_merge_result<F, U>(&mut self, res: Result<U>, map: F) where
F: Fn(U) -> V,
U: Validation,
[src]
F: Fn(U) -> V,
U: Validation,
Merge an unrelated validation into the context
pub fn into_result(self) -> Result<V>
[src]
Finish the current validation with a result
Returns Err
with the context's violations or Ok
if
the context does not have any violations.
Trait Implementations
impl<V: Clone> Clone for Context<V> where
V: Validation,
[src]
V: Validation,
fn clone(&self) -> Context<V>
[src]
fn clone_from(&mut self, source: &Self)
1.0.0[src]
Performs copy-assignment from source
. Read more
impl<V> Default for Context<V> where
V: Validation,
[src]
V: Validation,
impl<V> IntoIterator for Context<V> where
V: Validation,
[src]
V: Validation,
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> Display for Context<V> where
V: Validation + Display,
[src]
V: Validation + Display,
impl<V: Debug> Debug for Context<V> where
V: Validation,
[src]
V: Validation,
impl<V> Error for Context<V> where
V: Validation + Display,
[src]
V: Validation + Display,
fn description(&self) -> &str
1.0.0[src]
This method is soft-deprecated. Read more
fn cause(&self) -> Option<&dyn Error>
1.0.0[src]
replaced by Error::source, which can support downcasting
The lower-level cause of this error, if any. Read more
fn source(&self) -> Option<&(dyn Error + 'static)>
1.30.0[src]
The lower-level source of this error, if any. Read more
Auto Trait Implementations
impl<V> Sync for Context<V> where
V: Sync,
V: Sync,
impl<V> Send for Context<V> where
V: Send,
V: Send,
impl<V> Unpin for Context<V> where
V: Unpin,
V: Unpin,
impl<V> RefUnwindSafe for Context<V> where
V: RefUnwindSafe,
V: RefUnwindSafe,
impl<V> UnwindSafe for Context<V> where
V: RefUnwindSafe + UnwindSafe,
V: RefUnwindSafe + UnwindSafe,
Blanket Implementations
impl<V> Validation for V where
V: Any + Debug,
[src]
V: Any + Debug,
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<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> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T> ToString for T where
T: Display + ?Sized,
[src]
T: Display + ?Sized,
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
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> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,