pub trait SoaLayout: Component {
const FIELD_COUNT: usize;
const FIELD_NAMES: &'static [&'static str];
// Required methods
fn scatter_push(&self, fields: &mut [Vec<f32>]);
fn scatter_set(&self, fields: &mut [Vec<f32>], row: usize);
fn gather(fields: &[Vec<f32>], row: usize) -> Self;
}Expand description
Per-type knowledge the generic FieldSoaColumn needs to scatter a
component into its f32 field arrays and gather it back.
Generated by #[derive(Component)] + #[component(layout = "soa")] for
structs whose fields are all f32. The array order matches field
declaration order.
Required Associated Constants§
Sourceconst FIELD_COUNT: usize
const FIELD_COUNT: usize
Number of f32 fields this component decomposes into.
Sourceconst FIELD_NAMES: &'static [&'static str]
const FIELD_NAMES: &'static [&'static str]
Field names in declaration order (for the glass-box / debugging).
Required Methods§
Sourcefn scatter_push(&self, fields: &mut [Vec<f32>])
fn scatter_push(&self, fields: &mut [Vec<f32>])
Appends each of self’s fields onto the matching field array (one new
row).
fields.len() == FIELD_COUNT is guaranteed by the caller.
Sourcefn scatter_set(&self, fields: &mut [Vec<f32>], row: usize)
fn scatter_set(&self, fields: &mut [Vec<f32>], row: usize)
Overwrites row row of every field array with self’s fields.
fields.len() == FIELD_COUNT and row in bounds are guaranteed.
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.