Hash.apply

Applies the hash onto a value which is a class or struct given by T.

Fields in the destination value are assigned for which there exists an element with a matching key and type.

For example,

struct User
{
    string name;
    int age;
    bool admin;
    bool active;
}

User user;
Hash!(name => "Jesse", age => 24, active => "yes").apply(user);

assert(user.name == "Jesse"); // name => "Jesse"
assert(user.age  == 24);      // age  => 24
assert(user.admin == false);  // Unchanged (no key)
assert(user.active == false); // Unchanged (type mismatch)
struct Hash(args...)
static
T
apply
(
T
)
(
auto ref T dest
)
if (
is(T == class) ||
is(T == struct)
)

Meta