soa-derive
soa-derive copied to clipboard
Derive std::iter::Extend
Derived vec doesn't implement std::iter::Extend, in order to create struct of array without reallocation, we need to do following code in current version of this crate.
#[derive(StructOfArray)]
Struct Foo {
foo: String,
}
let vec_of_struct = vec![];
let mut struct_of_vec = FooVec::with_capacity(vec_of_struct.len());
for item in vec_of_struct {
struct_of_vec.push(item);
}
That's a good point. Adding this trait should not be too hard, although I have very little time for this crate nowadays. I'll be happy to review a PR contributing this feature.