Creates a new CustomRule with the given validator function.
validator
const CustomRule(this.validator);