exactLength

Value must be exactly N units long

@safe
@constraint
struct exactLength {}

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!(exactLength(2))("12"));
assert(!test!(exactLength(2))("1"));
assert(!test!(exactLength(2))("123"));

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

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

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

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

Meta