Crate swimos_errors

Source
Expand description

§Error Accumulation Framework

This crate provides Validation, an alternative to the standard library Result type. A function that returns a Result may succeed or fail with a single error. In contrast, Validation is used for processes that can produce an numbers of errors that do no necessarily cause processing to terminate. A function that returns a Validation may succeed (returning a value and no error), return a value and an error (indicating that processing may continue despite the error) or return an unconditional error (indicating that processing cannot continue).

Validations are composed as the process continues, therefore the error type must be composable that errors can be accumulated. Typically, the error type of a Validation will be a collection of error values and the composition operation will take the union of the two collections.

Structs§

Errors
A list of errors. This type will only allocate if there is more than 1 error in the list.

Enums§

Validation
An alternative to Result where errors are not necessarily fatal. The type E represents a (possibly empty) collection of errors.

Traits§

Append
Trait for error collection types that can have additional errors appended.
Recoverable
A trait from errors for which it is potentially possible to recover.
ValidationItExt
An extension trait for Iterator that adds combinators to apply a process returning Validations across all of the elements of the iterator, accumulating the errors.

Functions§

validate2
Combine two validated values, accumulating errors.
validate3
Combine three validated values, accumulating errors.