maxLength

Value must be shorter than or as long as N units

@safe
@constraint
struct maxLength {}

Members

Functions

check
bool check(T actual)
Undocumented in source. Be warned that the author may not have intended to support it.
errorMessage
string errorMessage()
Undocumented in source. Be warned that the author may not have intended to support it.

Variables

n
size_t n;
Undocumented in source.

Examples

assert(test!(maxLength(2))("1"));
assert(test!(maxLength(2))("12"));
assert(!test!(maxLength(2))("123"));

assert(test!(maxLength(4))("1234"));
assert(!test!(maxLength(4))("12345"));

assert(test!(maxLength(1))("1"));
assert(!test!(maxLength(1))("12"));

assert(test!(maxLength(0))(""));
assert(!test!(maxLength(0))("1"));

immutable string null_ = null;
assert(test!(maxLength(0))(null_));

Meta