pub struct Maybe<T>(/* private fields */);Expand description
Query type used to denote an optional column.
Use Maybe in queries to return bundles of components that may or may not
contain a component of the wrapped type T.
Trait Implementations§
Source§impl<'s, T: Send + Sync + 'static> IsQuery for Maybe<&'s T>
impl<'s, T: Send + Sync + 'static> IsQuery for Maybe<&'s T>
Source§type LockedColumns<'a> = Option<RwLockReadGuard<'a, RawRwLock, AnyVec<dyn Send + Sync>>>
type LockedColumns<'a> = Option<RwLockReadGuard<'a, RawRwLock, AnyVec<dyn Send + Sync>>>
Data that is read or write locked by performing this query.
Source§type ExtensionColumns = ()
type ExtensionColumns = ()
Data that can be used to append to columns. Typically vectors of
component entries or bundles of vectors of component entries.
Source§type QueryResult<'a> = Either<RepeatWith<fn() -> Option<&'a Entry<T>>>, Map<Iter<'a, Entry<T>>, for<'r> fn(&'r Entry<T>) -> Option<&'r Entry<T>>>>
type QueryResult<'a> = Either<RepeatWith<fn() -> Option<&'a Entry<T>>>, Map<Iter<'a, Entry<T>>, for<'r> fn(&'r Entry<T>) -> Option<&'r Entry<T>>>>
The iterator that is produced by performing a query on one archetype.
Source§type ParQueryResult<'a> = Either<Map<RepeatN<()>, fn(()) -> Option<&'a Entry<T>>>, Map<Iter<'a, Entry<T>>, for<'r> fn(&'r Entry<T>) -> Option<&'r Entry<T>>>>
type ParQueryResult<'a> = Either<Map<RepeatN<()>, fn(()) -> Option<&'a Entry<T>>>, Map<Iter<'a, Entry<T>>, for<'r> fn(&'r Entry<T>) -> Option<&'r Entry<T>>>>
The parallel iterator that is produced by performing a query on one
archetype.
fn reads() -> Vec<TypeKey>
fn writes() -> Vec<TypeKey>
Source§fn 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.
Source§fn extend_locked_columns<'a, 'b>(
_: &'b mut Self::LockedColumns<'a>,
_: Self::ExtensionColumns,
_: Option<(&mut Vec<usize>, &mut usize)>,
)
fn extend_locked_columns<'a, 'b>( _: &'b mut Self::LockedColumns<'a>, _: Self::ExtensionColumns, _: Option<(&mut Vec<usize>, &mut usize)>, )
Extend entries in the locked columns. Read more
Source§fn 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.
Source§fn 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.
Source§fn 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.
Source§impl<'s, T: Send + Sync + 'static> IsQuery for Maybe<&'s mut T>
impl<'s, T: Send + Sync + 'static> IsQuery for Maybe<&'s mut T>
Source§type LockedColumns<'a> = Option<RwLockWriteGuard<'a, RawRwLock, AnyVec<dyn Send + Sync>>>
type LockedColumns<'a> = Option<RwLockWriteGuard<'a, RawRwLock, AnyVec<dyn Send + Sync>>>
Data that is read or write locked by performing this query.
Source§type ExtensionColumns = ()
type ExtensionColumns = ()
Data that can be used to append to columns. Typically vectors of
component entries or bundles of vectors of component entries.
Source§type QueryResult<'a> = Either<RepeatWith<fn() -> Option<&'a mut Entry<T>>>, Map<IterMut<'a, Entry<T>>, for<'r> fn(&'r mut Entry<T>) -> Option<&'r mut Entry<T>>>>
type QueryResult<'a> = Either<RepeatWith<fn() -> Option<&'a mut Entry<T>>>, Map<IterMut<'a, Entry<T>>, for<'r> fn(&'r mut Entry<T>) -> Option<&'r mut Entry<T>>>>
The iterator that is produced by performing a query on one archetype.
Source§type ParQueryResult<'a> = Either<Map<RepeatN<()>, fn(()) -> Option<&'a mut Entry<T>>>, Map<IterMut<'a, Entry<T>>, for<'r> fn(&'r mut Entry<T>) -> Option<&'r mut Entry<T>>>>
type ParQueryResult<'a> = Either<Map<RepeatN<()>, fn(()) -> Option<&'a mut Entry<T>>>, Map<IterMut<'a, Entry<T>>, for<'r> fn(&'r mut Entry<T>) -> Option<&'r mut Entry<T>>>>
The parallel iterator that is produced by performing a query on one
archetype.
fn reads() -> Vec<TypeKey>
fn writes() -> Vec<TypeKey>
Source§fn 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.
Source§fn extend_locked_columns<'a, 'b>(
_: &'b mut Self::LockedColumns<'a>,
_: Self::ExtensionColumns,
_: Option<(&mut Vec<usize>, &mut usize)>,
)
fn extend_locked_columns<'a, 'b>( _: &'b mut Self::LockedColumns<'a>, _: Self::ExtensionColumns, _: Option<(&mut Vec<usize>, &mut usize)>, )
Extend entries in the locked columns. Read more
Source§fn 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.
Source§fn 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.
Source§fn 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.
Auto Trait Implementations§
impl<T> Freeze for Maybe<T>
impl<T> RefUnwindSafe for Maybe<T>where
T: RefUnwindSafe,
impl<T> Send for Maybe<T>where
T: Send,
impl<T> Sync for Maybe<T>where
T: Sync,
impl<T> Unpin for Maybe<T>where
T: Unpin,
impl<T> UnwindSafe for Maybe<T>where
T: UnwindSafe,
Blanket Implementations§
§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more