Skip to main content

FieldSoaColumn

Struct FieldSoaColumn 

Source
pub struct FieldSoaColumn<T: SoaLayout> { /* private fields */ }
Expand description

A field-split component column: one contiguous Vec<f32> per component field.

Stored behind Box<dyn AnyVec> exactly like an AoS Vec<T> column, so it participates in the normal page lifecycle (spawn / despawn / migration / serialization). Access is by value (get) or in bulk through the per-field field slices for SIMD kernels.

Implementations§

Source§

impl<T: SoaLayout> FieldSoaColumn<T>

Source

pub fn new() -> Self

Creates an empty column with one field array per component field.

Source

pub fn len(&self) -> usize

The number of rows (entities) stored.

Source

pub fn is_empty(&self) -> bool

Whether the column holds no rows.

Source

pub fn push(&mut self, value: T)

Appends a value as a new row.

Source

pub fn get(&self, row: usize) -> T

Reconstructs the value stored at row.

§Panics

Panics if row >= len().

Source

pub fn set(&mut self, row: usize, value: T)

Overwrites the value at row.

§Panics

Panics if row >= len().

Source

pub fn field(&self, field: usize) -> &[f32]

Read-only access to one field’s array (field < FIELD_COUNT) — the contiguous f32 stream a SIMD kernel tiles over.

Source

pub fn field_mut(&mut self, field: usize) -> &mut [f32]

Mutable access to one field’s array.

Source

pub fn fields(&self) -> &[Vec<f32>]

All field arrays (read-only).

Source

pub fn fields_mut(&mut self) -> &mut [Vec<f32>]

All field arrays (mutable) — for a kernel that writes several fields.

Trait Implementations§

Source§

impl<T: SoaLayout> AnyVec for FieldSoaColumn<T>

Source§

fn as_any(&self) -> &dyn Any

Casts the trait object to &dyn Any.
Source§

fn as_any_mut(&mut self) -> &mut dyn Any

Casts the trait object to &mut dyn Any.
Source§

fn swap_remove_any(&mut self, index: usize)

Performs a swap_remove on the underlying column, removing the element at index.
Source§

fn to_bytes(&self) -> Vec<u8>

Serialises the column to an owned byte buffer. Read more
Source§

unsafe fn set_from_bytes( &mut self, bytes: &[u8], ) -> Result<(), SetFromBytesError>

Replaces the column contents from bytes previously produced by to_bytes on the same column type. Read more
Source§

impl<T: Debug + SoaLayout> Debug for FieldSoaColumn<T>

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl<T: SoaLayout> Default for FieldSoaColumn<T>

Source§

fn default() -> Self

Returns the “default value” for a type. Read more

Auto Trait Implementations§

§

impl<T> Freeze for FieldSoaColumn<T>

§

impl<T> RefUnwindSafe for FieldSoaColumn<T>

§

impl<T> Send for FieldSoaColumn<T>

§

impl<T> Sync for FieldSoaColumn<T>

§

impl<T> Unpin for FieldSoaColumn<T>

§

impl<T> UnsafeUnpin for FieldSoaColumn<T>

§

impl<T> UnwindSafe for FieldSoaColumn<T>

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
§

impl<T> AppLifecycle for T
where T: ?Sized,

§

fn on_start(&mut self, ctx: &mut dyn AppContext)

Called once after the backend is up but before the first update. Apps install their theme / fonts here.
§

fn on_exit(&mut self)

Called once when the window is closing. Persist state here.
§

impl<T> AsAny for T
where T: Any,

§

fn as_any(&self) -> &(dyn Any + 'static)

Returns a reference to the inner value as &dyn Any.
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.