Struct Valid

Source
pub struct Valid<A, E, T>(/* private fields */);

Implementations§

Source§

impl<A, E, T> Valid<A, E, T>

Source

pub fn fail(e: E) -> Valid<A, E, T>

Source

pub fn fail_at(error: E, trace: T) -> Valid<A, E, T>
where E: Debug,

Source

pub fn succeed(a: A) -> Valid<A, E, T>

Source

pub fn from_iter<B>( iter: impl IntoIterator<Item = A>, f: impl FnMut(A) -> Valid<B, E, T>, ) -> Valid<Vec<B>, E, T>

Source

pub fn from_option(option: Option<A>, e: E) -> Valid<A, E, T>

Source

pub fn none() -> Valid<Option<A>, E, T>

Trait Implementations§

Source§

impl<A, E, T> Clone for Valid<A, E, T>
where A: Clone, E: Clone, T: Clone,

Source§

fn clone(&self) -> Self

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl<A: Debug, E: Debug, T: Debug> Debug for Valid<A, E, T>

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl<A, E, T> From<Cause<E, T>> for Valid<A, E, T>

Source§

fn from(value: Cause<E, T>) -> Self

Converts to this type from the input type.
Source§

impl<A, E, T> From<Fusion<A, E, T>> for Valid<A, E, T>

Source§

fn from(value: Fusion<A, E, T>) -> Self

Converts to this type from the input type.
Source§

impl<A, E, T> From<Result<A, Cause<E, T>>> for Valid<A, E, T>

Source§

fn from(value: Result<A, Cause<E, T>>) -> Self

Converts to this type from the input type.
Source§

impl<A, E, T> From<Vec<Cause<E, T>>> for Valid<A, E, T>

Source§

fn from(value: Vec<Cause<E, T>>) -> Self

Converts to this type from the input type.
Source§

impl<A: PartialEq, E: PartialEq, T: PartialEq> PartialEq for Valid<A, E, T>

Source§

fn eq(&self, other: &Valid<A, E, T>) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl<A, E, T> Validator<A, E, T> for Valid<A, E, T>

Source§

fn to_result(self) -> Result<A, Vec<Cause<E, T>>>

Source§

fn is_succeed(&self) -> bool

Source§

fn is_fail(&self) -> bool

Source§

fn map<A1>(self, f: impl FnOnce(A) -> A1) -> Valid<A1, E, T>

Source§

fn foreach(self, f: impl FnMut(A)) -> Valid<A, E, T>
where A: Clone,

Source§

fn and<A1>(self, other: Valid<A1, E, T>) -> Valid<A1, E, T>

Source§

fn zip<A1>(self, other: Valid<A1, E, T>) -> Valid<(A, A1), E, T>

Source§

fn fuse<A1>(self, other: Valid<A1, E, T>) -> Fusion<(A, A1), E, T>

Source§

fn trace(self, trace: impl Into<T> + Clone) -> Valid<A, E, T>

Source§

fn fold<A1>( self, ok: impl FnOnce(A) -> Valid<A1, E, T>, err: impl FnOnce() -> Valid<A1, E, T>, ) -> Valid<A1, E, T>

Source§

fn and_then<B>(self, f: impl FnOnce(A) -> Valid<B, E, T>) -> Valid<B, E, T>

Source§

fn unit(self) -> Valid<(), E, T>

Source§

fn some(self) -> Valid<Option<A>, E, T>

Source§

fn map_to<B>(self, b: B) -> Valid<B, E, T>

Source§

fn when(self, f: impl FnOnce() -> bool) -> Valid<(), E, T>

Source§

impl<A, E, T> StructuralPartialEq for Valid<A, E, T>

Auto Trait Implementations§

§

impl<A, E, T> Freeze for Valid<A, E, T>
where A: Freeze,

§

impl<A, E, T> RefUnwindSafe for Valid<A, E, T>

§

impl<A, E, T> Send for Valid<A, E, T>
where A: Send, E: Send, T: Send,

§

impl<A, E, T> Sync for Valid<A, E, T>
where A: Sync, E: Sync, T: Sync,

§

impl<A, E, T> Unpin for Valid<A, E, T>
where A: Unpin, E: Unpin, T: Unpin,

§

impl<A, E, T> UnwindSafe for Valid<A, E, T>
where A: UnwindSafe, E: UnwindSafe, T: UnwindSafe,

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

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

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<S, T> ValidateInto<T> for S
where T: ValidateFrom<S>,

Source§

type Error = <T as ValidateFrom<S>>::Error

Source§

type Trace = <T as ValidateFrom<S>>::Trace

Source§

fn validate_into( self, ) -> Valid<T, <S as ValidateInto<T>>::Error, <S as ValidateInto<T>>::Trace>