Module vstrext

Module vstrext 

Source
Expand description

Extension of vstr module with convenience rules.

§Logic

  • Conjunction using Conj
  • Disjunction using Disj
  • Negation using Neg

For conjunction and disjunction, the rules are always checked from the left and right, and short-circuiting is used.

The logical connectives may discard the error types of the rules they operate on in certain cases. These cases are documented in the respective types.

§String size checking

NOTE: For dynamic bounds, please define your own rules. Your rule just needs to implement ValidateString.

The helpful macros easy_rule and fast_rule can help you with this task.

§String content checking

Structs§

BothError
Errors from both left and right, if only both places returned errors.
Conj
Require both rules to pass, from left to right.
Disj
Require either rule to pass, from left to right.
Neg
Require the rule to NOT pass.
NegationPassedError
The underlying rule passed.
StringAsciiRule
Require the string to not have any non-ASCII bytes.
StringHadNonAsciiError
String had non-ASCII bytes.
StringMaxSizeRule
A rule that checks a string’s length against an inclusive upper bound.
StringMinSizeRule
A rule that checks a string’s length against an inclusive lower bound.
StringSizeOutOfRangeError
Out of range (bytes)
StringSizeRule
A rule that checks the size of a string.

Enums§

EitherError
An error from either left or right.

Type Aliases§

StringExactSizeRule
A rule that guarantees an exact length in bytes.
StringNonEmptyRule
A rule that says a string must not be empty.