ValidationResult

Type Alias ValidationResult 

Source
pub type ValidationResult<T> = Result<T, ValidationErrors>;
Expand description

Result type for validation operations.

Returns Ok(T) on success, or Err(ValidationErrors) containing all validation failures.

Aliased Type§

pub enum ValidationResult<T> {
    Ok(T),
    Err(ValidationErrors),
}

Variants§

§1.0.0

Ok(T)

Contains the success value

§1.0.0

Err(ValidationErrors)

Contains the error value

Trait Implementations§

Source§

impl<T> ValidationResultExt<T> for ValidationResult<T>

Source§

fn map_valid<U, F: FnOnce(T) -> U>(self, f: F) -> ValidationResult<U>

Map the success value, preserving validation errors
Source§

fn and_also<U>(self, other: ValidationResult<U>) -> ValidationResult<(T, U)>

Combine with another validation result, collecting all errors
Source§

fn with_errors(self, other: ValidationResult<()>) -> ValidationResult<T>

Add errors from another result without changing the success type