pub fn validate<T, F, S>(value: T, validator: F, message: S) -> CoreResult<T>Expand description
Checks if a value is valid according to a validator function
§Arguments
value- The value to validatevalidator- A function that returns true if the value is validmessage- The error message if the value is invalid
§Returns
Ok(value)if the value is validErr(CoreError::ValidationError)if the value is invalid
§Errors
Returns CoreError::ValidationError if the validator function returns false.