Here is an example struct using it and the expansion
#[derive(SoA, Resource, Reflect, Debug, Default)]
pub struct BuildingRegistry {
ids: Vec<BuildingId>,
scopes: Vec<ScopeId>,
sids: Vec<String>,
names: Vec<String>,
costs: Vec<Vec<(ItemId, u32)>>,
}
struct BuildingRegistryEntry {
ids: BuildingId,
scopes: ScopeId,
sids: String,
names: String,
costs: Vec<(ItemId, u32)>,
}
impl BuildingRegistry {
#[inline]
fn push(&mut self, entry: BuildingRegistryEntry) {
self.ids.push(entry.ids);
self.scopes.push(entry.scopes);
self.sids.push(entry.sids);
self.names.push(entry.names);
self.costs.push(entry.costs);
}
#[inline]
fn len(&self) -> usize {
self.ids.len()
}
}
impl FromIterator<BuildingRegistryEntry> for BuildingRegistry {
fn from_iter<T: IntoIterator<Item = BuildingRegistryEntry>>(iter: T) -> Self {
let mut collection = Self::default();
iter.into_iter().for_each(|entry| collection.push(entry));
collection
}
}