jbaublitz/getset

Specific behaviour for collections.

Luro02 opened this issue · 1 comments

For example

struct Hello {
    value: Vec<usize>,
}

the value field will be set like any other (set_value(vec)), but it'd be more useful to have something like this additionally;

hello.push_value(1);
hello.set_value(vec![1, 2, 3, 4]);
hello.push_value(5);

assert_eq!(hello.value, vec![1, 2, 3, 4, 5]);

The same could be done for other kinds of collections like HashMap or BTreeMap. (std::collections)

This library isn't interested in implementing magic, if you need nontrivial functionality I suggest implementing in your code. :)