pub trait Validator<A, E>: Sized {
Show 15 methods
// Required methods
fn is_succeed(&self) -> bool;
fn is_fail(&self) -> bool;
fn to_result(self) -> Result<A, ValidationError<E>>;
// Provided methods
fn map<A1>(self, f: impl FnOnce(A) -> A1) -> Valid<A1, E> { ... }
fn foreach(self, f: impl FnMut(A)) -> Valid<A, E>
where A: Clone { ... }
fn and<A1>(self, other: Valid<A1, E>) -> Valid<A1, E> { ... }
fn zip<A1>(self, other: Valid<A1, E>) -> Valid<(A, A1), E> { ... }
fn fuse<A1>(self, other: Valid<A1, E>) -> Fusion<(A, A1), E> { ... }
fn trace(self, message: &str) -> Valid<A, E> { ... }
fn fold<A1>(
self,
ok: impl FnOnce(A) -> Valid<A1, E>,
err: impl FnOnce() -> Valid<A1, E>,
) -> Valid<A1, E> { ... }
fn and_then<B>(self, f: impl FnOnce(A) -> Valid<B, E>) -> Valid<B, E> { ... }
fn unit(self) -> Valid<(), E> { ... }
fn some(self) -> Valid<Option<A>, E> { ... }
fn map_to<B>(self, b: B) -> Valid<B, E> { ... }
fn when(self, f: impl FnOnce() -> bool) -> Valid<(), E> { ... }
}
Required Methods§
fn is_succeed(&self) -> bool
fn is_fail(&self) -> bool
fn to_result(self) -> Result<A, ValidationError<E>>
Provided Methods§
fn map<A1>(self, f: impl FnOnce(A) -> A1) -> Valid<A1, E>
fn foreach(self, f: impl FnMut(A)) -> Valid<A, E>where
A: Clone,
fn and<A1>(self, other: Valid<A1, E>) -> Valid<A1, E>
fn zip<A1>(self, other: Valid<A1, E>) -> Valid<(A, A1), E>
fn fuse<A1>(self, other: Valid<A1, E>) -> Fusion<(A, A1), E>
fn trace(self, message: &str) -> Valid<A, E>
fn fold<A1>( self, ok: impl FnOnce(A) -> Valid<A1, E>, err: impl FnOnce() -> Valid<A1, E>, ) -> Valid<A1, E>
fn and_then<B>(self, f: impl FnOnce(A) -> Valid<B, E>) -> Valid<B, E>
fn unit(self) -> Valid<(), E>
fn some(self) -> Valid<Option<A>, E>
fn map_to<B>(self, b: B) -> Valid<B, E>
fn when(self, f: impl FnOnce() -> bool) -> Valid<(), E>
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.