Skip to main content

Soa

Struct Soa 

Source
pub struct Soa<T: SoaLayout>(/* private fields */);
Expand description

A query that reads a field-SoA component by value.

A component stored field-SoA (#[component(layout = "soa")]) cannot be borrowed as &T — its bytes are split across per-field lanes, not laid out as a contiguous T — so it is queried as Soa<T>, which yields an owned T reconstructed (gathered) from the lanes. For the bulk SIMD path that is the point of the layout, use World::for_each_soa_column_mut instead; Soa<T> is the per-row, mix-with-other-components access.

Trait Implementations§

Source§

impl<T: SoaLayout> WorldQuery for Soa<T>

Source§

type Item<'a> = T

The type of item that the query iterator will yield (e.g., (&'a Position, &'a mut Velocity)).
Source§

fn type_ids() -> Vec<TypeId>

Returns the sorted list of TypeIds for the components to be INCLUDED in the query. This signature is used to find ComponentPages that contain all these components.
Source§

unsafe fn fetch<'a>( page_ptr: *const ComponentPage, row_index: usize, ) -> Self::Item<'a>

Fetches the query’s item from a specific row in a ComponentPage. Read more
Source§

unsafe fn fetch_from_world<'a>( world: *const World, entity_id: EntityId, ) -> Option<Self::Item<'a>>

Fetches the query’s item directly from the world for a specific entity. Read more
Source§

fn without_type_ids() -> Vec<TypeId>

Returns the sorted list of TypeIds for components to be EXCLUDED from the query. Used to filter out pages that contain these components.
Source§

fn mutable_type_ids() -> Vec<TypeId>

Returns the TypeIds of the components this query accesses mutably (&mut T / Option<&mut T> terms). World::query_mut uses this to mark the matching domains changed once per query construction. Read-only terms and filters return nothing (the default).

Auto Trait Implementations§

§

impl<T> Freeze for Soa<T>

§

impl<T> RefUnwindSafe for Soa<T>
where T: RefUnwindSafe,

§

impl<T> Send for Soa<T>

§

impl<T> Sync for Soa<T>

§

impl<T> Unpin for Soa<T>
where T: Unpin,

§

impl<T> UnsafeUnpin for Soa<T>

§

impl<T> UnwindSafe for Soa<T>
where T: UnwindSafe,

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.