Simply a learning avenue for proc-macros...
Derive Vec
like behavior for a struct with an inner Vec
.
use derive_vec::{VecBehavior, VecTrait};
#[derive(VecBehavior, Default)]
struct Foo {
#[vec]
pub values: Vec<usize>,
}
fn main() {
let mut foo = Foo::default();
foo.push(1);
assert_eq!(foo.values.len(), 1);
}
- Support for non-generic structs
- Support for generic structs