pub fn require_that<T, F>(
value: T,
path: &str,
predicate: F,
code: &str,
message: &str,
) -> ArgumentResult<T>Expand description
Validates a value with a caller-provided predicate.
The predicate receives a shared reference to value. If it returns true,
this function returns the original value without cloning it or allocating
error strings. If it returns false, path, code, and message identify
the failed validation rule.
ยงErrors
Returns ArgumentErrorKind::Custom when predicate returns false.
The error owns copies of path, code, and message.