Expand description
maybe-valid provides traits and dedicated outcome enums for
structural validation/refinement conversions.
Core pieces:
Validated: declares a canonical diagnostic reason type for a validated target.AsValidated: borrow-based validation (&Self->&V).IntoValidated: owning validation (Self->V, with precursor recovery on failure).MaybeValidRefandMaybeValidOwned: explicit valid/invalid outcomes (intentionally distinct fromResult) that carry precursor data on the invalid branch.
Feature flags:
std(default): enablesallocand all provided std/alloc-backed impls.alloc: enables owned string/C string conversions.- no default features: keeps core/no-alloc functionality.
Structs§
- Zero
Reason - Returned on the invalid path when validating an integer as a
corresponding
NonZero*type.
Enums§
- CStr
Invalid Reason - Returned on the invalid path when validating bytes as
CStrorCString. - Maybe
Valid Owned - The outcome of consuming a value into a validated form of type
V. - Maybe
Valid Ref - The outcome of borrowing a value as a validated view of type
V.
Traits§
- AsValidated
- Borrows
Selfas a validated view of typeV, ifselfsatisfiesV’s predicate. - Into
Validated - Consumes
Selfinto a validated value of typeV, ifselfsatisfiesV’s predicate. - Validated
- A type whose values are guaranteed to satisfy a validation predicate.