tailcall_valid

Struct Valid

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

Implementations§

source§

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

source

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

source

pub fn fail_with(message: E, description: E) -> Valid<A, E>
where E: Debug,

source

pub fn from_validation_err(error: ValidationError<E>) -> Self

source

pub fn from_vec_cause(error: Vec<Cause<E>>) -> Self

source

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

source

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

source

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

source

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

Trait Implementations§

source§

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

source§

fn clone(&self) -> Self

Returns a copy 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> Debug for Valid<A, E>

source§

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

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

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

source§

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

Converts to this type from the input type.
source§

impl<A, E> From<Result<A, ValidationError<E>>> for Valid<A, E>

source§

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

Converts to this type from the input type.
source§

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

source§

fn eq(&self, other: &Valid<A, E>) -> 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> Validator<A, E> for Valid<A, E>

source§

fn to_result(self) -> Result<A, ValidationError<E>>

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>

source§

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

source§

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

source§

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

source§

fn trace(self, message: &str) -> Valid<A, E>

source§

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

source§

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

source§

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

source§

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

source§

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

source§

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

source§

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

Auto Trait Implementations§

§

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

§

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

§

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

§

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

§

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

§

impl<A, E> UnwindSafe for Valid<A, E>
where A: UnwindSafe, E: 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, dst: *mut T)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dst. 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§

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