pub trait ValidationResultExt<T> {
// Required methods
fn map_valid<U, F>(self, f: F) -> Result<U, ValidationErrors>
where F: FnOnce(T) -> U;
fn and_also<U>(
self,
other: Result<U, ValidationErrors>,
) -> Result<(T, U), ValidationErrors>;
fn with_errors(
self,
other: Result<(), ValidationErrors>,
) -> Result<T, ValidationErrors>;
}Expand description
Extension trait for ValidationResult
Required Methods§
Sourcefn map_valid<U, F>(self, f: F) -> Result<U, ValidationErrors>where
F: FnOnce(T) -> U,
fn map_valid<U, F>(self, f: F) -> Result<U, ValidationErrors>where
F: FnOnce(T) -> U,
Map the success value, preserving validation errors
Sourcefn and_also<U>(
self,
other: Result<U, ValidationErrors>,
) -> Result<(T, U), ValidationErrors>
fn and_also<U>( self, other: Result<U, ValidationErrors>, ) -> Result<(T, U), ValidationErrors>
Combine with another validation result, collecting all errors
Sourcefn with_errors(
self,
other: Result<(), ValidationErrors>,
) -> Result<T, ValidationErrors>
fn with_errors( self, other: Result<(), ValidationErrors>, ) -> Result<T, ValidationErrors>
Add errors from another result without changing the success type
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".