pub trait IsQuery {
type LockedColumns<'a>;
type ExtensionColumns: 'static;
type QueryResult<'a>: Iterator<Item = Self::QueryRow<'a>>;
type ParQueryResult<'a>: ParallelIterator<Item = Self::QueryRow<'a>> + IndexedParallelIterator;
type QueryRow<'a>: Send + Sync;
// Required methods
fn reads() -> Vec<TypeKey>;
fn writes() -> Vec<TypeKey>;
fn lock_columns<'a>(arch: &'a Archetype) -> Self::LockedColumns<'a>;
fn extend_locked_columns<'a, 'b>(
lock: &'b mut Self::LockedColumns<'a>,
extension_columns: Self::ExtensionColumns,
output_ids: Option<(&mut Vec<usize>, &mut usize)>,
);
fn iter_mut<'a, 'b>(
lock: &'b mut Self::LockedColumns<'a>,
) -> Self::QueryResult<'b>;
fn iter_one<'a, 'b>(
lock: &'b mut Self::LockedColumns<'a>,
index: usize,
) -> Self::QueryResult<'b>;
fn par_iter_mut<'a, 'b>(
len: usize,
lock: &'b mut Self::LockedColumns<'a>,
) -> Self::ParQueryResult<'b>;
}Expand description
Denotes the shape of a query that can be used to iterate over bundles of components.
Required Associated Types§
Sourcetype LockedColumns<'a>
type LockedColumns<'a>
Data that is read or write locked by performing this query.
Sourcetype ExtensionColumns: 'static
type ExtensionColumns: 'static
Data that can be used to append to columns. Typically vectors of component entries or bundles of vectors of component entries.
Sourcetype QueryResult<'a>: Iterator<Item = Self::QueryRow<'a>>
type QueryResult<'a>: Iterator<Item = Self::QueryRow<'a>>
The iterator that is produced by performing a query on one archetype.
Sourcetype ParQueryResult<'a>: ParallelIterator<Item = Self::QueryRow<'a>> + IndexedParallelIterator
type ParQueryResult<'a>: ParallelIterator<Item = Self::QueryRow<'a>> + IndexedParallelIterator
The parallel iterator that is produced by performing a query on one archetype.
Required Methods§
fn reads() -> Vec<TypeKey>
fn writes() -> Vec<TypeKey>
Sourcefn lock_columns<'a>(arch: &'a Archetype) -> Self::LockedColumns<'a>
fn lock_columns<'a>(arch: &'a Archetype) -> Self::LockedColumns<'a>
Find and acquire a “lock” on the columns for reading or writing.
Sourcefn extend_locked_columns<'a, 'b>(
lock: &'b mut Self::LockedColumns<'a>,
extension_columns: Self::ExtensionColumns,
output_ids: Option<(&mut Vec<usize>, &mut usize)>,
)
fn extend_locked_columns<'a, 'b>( lock: &'b mut Self::LockedColumns<'a>, extension_columns: Self::ExtensionColumns, output_ids: Option<(&mut Vec<usize>, &mut usize)>, )
Extend entries in the locked columns.
This is for internal use only.
Sourcefn iter_mut<'a, 'b>(
lock: &'b mut Self::LockedColumns<'a>,
) -> Self::QueryResult<'b>
fn iter_mut<'a, 'b>( lock: &'b mut Self::LockedColumns<'a>, ) -> Self::QueryResult<'b>
Create an iterator over the rows of the given columns.
Sourcefn iter_one<'a, 'b>(
lock: &'b mut Self::LockedColumns<'a>,
index: usize,
) -> Self::QueryResult<'b>
fn iter_one<'a, 'b>( lock: &'b mut Self::LockedColumns<'a>, index: usize, ) -> Self::QueryResult<'b>
Create an iterator over one row with the given index.
Sourcefn par_iter_mut<'a, 'b>(
len: usize,
lock: &'b mut Self::LockedColumns<'a>,
) -> Self::ParQueryResult<'b>
fn par_iter_mut<'a, 'b>( len: usize, lock: &'b mut Self::LockedColumns<'a>, ) -> Self::ParQueryResult<'b>
Create an iterator over the rows of the given columns.
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.
Implementations on Foreign Types§
Source§impl<'s, T: Send + Sync + 'static> IsQuery for &'s T
impl<'s, T: Send + Sync + 'static> IsQuery for &'s T
Source§fn par_iter_mut<'a, 'b>(
_: usize,
lock: &'b mut Self::LockedColumns<'a>,
) -> Self::ParQueryResult<'b>
fn par_iter_mut<'a, 'b>( _: usize, lock: &'b mut Self::LockedColumns<'a>, ) -> Self::ParQueryResult<'b>
Create an iterator over the rows of the given columns.
type LockedColumns<'a> = Option<RwLockReadGuard<'a, RawRwLock, AnyVec<dyn Sync + Send>>>
type ExtensionColumns = ()
type QueryResult<'a> = Iter<'a, Entry<T>>
type ParQueryResult<'a> = Iter<'a, Entry<T>>
type QueryRow<'a> = &'a Entry<T>
fn reads() -> Vec<TypeKey>
fn writes() -> Vec<TypeKey>
fn lock_columns<'t>(arch: &'t Archetype) -> Self::LockedColumns<'t>
fn extend_locked_columns<'a, 'b>( _: &'b mut Self::LockedColumns<'a>, (): Self::ExtensionColumns, _: Option<(&mut Vec<usize>, &mut usize)>, )
fn iter_mut<'a, 'b>( locked: &'b mut Self::LockedColumns<'a>, ) -> Self::QueryResult<'b>
fn iter_one<'a, 'b>( lock: &'b mut Self::LockedColumns<'a>, index: usize, ) -> Self::QueryResult<'b>
Source§impl<'s, T: Send + Sync + 'static> IsQuery for &'s mut T
impl<'s, T: Send + Sync + 'static> IsQuery for &'s mut T
Source§fn par_iter_mut<'a, 'b>(
_: usize,
lock: &'b mut Self::LockedColumns<'a>,
) -> Self::ParQueryResult<'b>
fn par_iter_mut<'a, 'b>( _: usize, lock: &'b mut Self::LockedColumns<'a>, ) -> Self::ParQueryResult<'b>
Create an iterator over the rows of the given columns.