pub struct Component<T> { /* private fields */ }
Expand description
Defines a strongly typed component.
Implements a read only fetch when used as part of a query
Use .as_mut()
to acquire a mutable fetch.
Implementations§
Source§impl<T: ComponentValue> Component<T>
impl<T: ComponentValue> Component<T>
Sourcepub fn key(&self) -> ComponentKey
pub fn key(&self) -> ComponentKey
Get the component’s id.
Sourcepub fn id(&self) -> Entity
pub fn id(&self) -> Entity
Get the component’s base id. This is the id without any relation target
Sourcepub fn desc(self) -> ComponentDesc
pub fn desc(self) -> ComponentDesc
Returns the type erased component description
Sourcepub fn into_change_filter(self, kind: ChangeKind) -> ChangeFilter<T>
pub fn into_change_filter(self, kind: ChangeKind) -> ChangeFilter<T>
Construct a fine grained change detection filter.
Prefer TransformFetch
if not in a const context
Trait Implementations§
Source§impl<'w, T> Fetch<'w> for Component<T>where
T: ComponentValue,
impl<'w, T> Fetch<'w> for Component<T>where
T: ComponentValue,
Source§const MUTABLE: bool = false
const MUTABLE: bool = false
true if the fetch mutates any component and thus needs a change event
Source§fn prepare(&self, data: FetchPrepareData<'w>) -> Option<Self::Prepared>
fn prepare(&self, data: FetchPrepareData<'w>) -> Option<Self::Prepared>
Prepares the fetch for an archetype by acquiring borrows. Read more
Source§fn filter_arch(&self, data: FetchAccessData<'_>) -> bool
fn filter_arch(&self, data: FetchAccessData<'_>) -> bool
Returns true if the archetype matches the fetch
Source§fn access(&self, data: FetchAccessData<'_>, dst: &mut Vec<Access>)
fn access(&self, data: FetchAccessData<'_>, dst: &mut Vec<Access>)
Returns which components and how will be accessed for an archetype.
Source§fn describe(&self, f: &mut Formatter<'_>) -> Result
fn describe(&self, f: &mut Formatter<'_>) -> Result
Describes the fetch in a human-readable fashion
Source§fn searcher(&self, searcher: &mut ArchetypeSearcher)
fn searcher(&self, searcher: &mut ArchetypeSearcher)
Returns the required component for the fetch. Read more
Source§impl<'q, T: ComponentValue> FetchItem<'q> for Component<T>
impl<'q, T: ComponentValue> FetchItem<'q> for Component<T>
Source§impl<T: ComponentValue> From<Component<T>> for ComponentDesc
impl<T: ComponentValue> From<Component<T>> for ComponentDesc
Source§impl<T: ComponentValue> Metadata<T> for Component<T>
impl<T: ComponentValue> Metadata<T> for Component<T>
Source§fn attach(desc: ComponentDesc, buffer: &mut ComponentBuffer)
fn attach(desc: ComponentDesc, buffer: &mut ComponentBuffer)
Attach the metadata to the component buffer
Source§impl<T: ComponentValue> RelationExt<T> for Component<T>
impl<T: ComponentValue> RelationExt<T> for Component<T>
Source§fn with_relation(self) -> WithRelation
fn with_relation(self) -> WithRelation
Construct a new filter yielding entities with this kind of relation
Source§fn without_relation(self) -> WithoutRelation
fn without_relation(self) -> WithoutRelation
Construct a new filter yielding entities without this kind of relation
Source§fn vtable(&self) -> &'static UntypedVTable
fn vtable(&self) -> &'static UntypedVTable
Returns the vtable of the relation
Source§fn as_relation(&self) -> Relation<T>
fn as_relation(&self) -> Relation<T>
Convert this into a concrete relation representation
Source§fn nth_relation(self, n: usize) -> NthRelation<T>where
Self: Sized,
fn nth_relation(self, n: usize) -> NthRelation<T>where
Self: Sized,
Query the nth relation of the specified kind. Read more
Source§fn first_relation(self) -> NthRelation<T>where
Self: Sized,
fn first_relation(self) -> NthRelation<T>where
Self: Sized,
Query the first relation of the specified kind.
Source§impl<T: ComponentValue> TransformFetch<Added> for Component<T>
impl<T: ComponentValue> TransformFetch<Added> for Component<T>
Source§type Output = ChangeFilter<T>
type Output = ChangeFilter<T>
The transformed type. Read more
Source§fn transform_fetch(self, _: Added) -> Self::Output
fn transform_fetch(self, _: Added) -> Self::Output
Transform the fetch using the provided method
Source§impl<T: ComponentValue> TransformFetch<Modified> for Component<T>
impl<T: ComponentValue> TransformFetch<Modified> for Component<T>
Source§type Output = ChangeFilter<T>
type Output = ChangeFilter<T>
The transformed type. Read more
Source§fn transform_fetch(self, _: Modified) -> Self::Output
fn transform_fetch(self, _: Modified) -> Self::Output
Transform the fetch using the provided method
impl<T> Copy for Component<T>
impl<T> Eq for Component<T>
Auto Trait Implementations§
impl<T> Freeze for Component<T>
impl<T> RefUnwindSafe for Component<T>where
T: RefUnwindSafe,
impl<T> Send for Component<T>where
T: Send,
impl<T> Sync for Component<T>where
T: Sync,
impl<T> Unpin for Component<T>where
T: Unpin,
impl<T> UnwindSafe for Component<T>where
T: UnwindSafe,
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§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> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<F> FetchExt for Fwhere
F: for<'x> Fetch<'x>,
impl<F> FetchExt for Fwhere
F: for<'x> Fetch<'x>,
Source§fn opt_or<V>(self, default: V) -> OptOr<Self, V>
fn opt_or<V>(self, default: V) -> OptOr<Self, V>
Transform the fetch into a fetch with a provided default.
This is useful for default values such as scale or velocity which may
not exist for every entity.
Source§fn satisfied(self) -> Satisfied<Self>
fn satisfied(self) -> Satisfied<Self>
Returns true if the query is satisfied, without borrowing
Source§fn opt_or_default<V>(self) -> OptOr<Self, V>
fn opt_or_default<V>(self) -> OptOr<Self, V>
Transform the fetch into a fetch which yields the default impl if the
fetch is not matched.
Source§fn copied(self) -> Copied<Self>where
Copied<Self>: for<'x> Fetch<'x>,
fn copied(self) -> Copied<Self>where
Copied<Self>: for<'x> Fetch<'x>,
Transform this into a copied fetch
Source§fn ge<T>(self, other: T) -> Cmp<Self, GreaterEq<T>>
fn ge<T>(self, other: T) -> Cmp<Self, GreaterEq<T>>
Filter any component greater than or equal to
other
.Source§fn le<T>(self, other: T) -> Cmp<Self, LessEq<T>>
fn le<T>(self, other: T) -> Cmp<Self, LessEq<T>>
Filter any component less than or equal to
other
.Source§fn source<S>(self, source: S) -> Source<Self, S>where
S: FetchSource,
fn source<S>(self, source: S) -> Source<Self, S>where
S: FetchSource,
Set the source entity for the fetch. Read more
Source§fn relation<T, R>(self, relation: R) -> Source<Self, FromRelation>where
R: RelationExt<T>,
T: ComponentValue,
fn relation<T, R>(self, relation: R) -> Source<Self, FromRelation>where
R: RelationExt<T>,
T: ComponentValue,
Follows a relation to resolve the fetch. Read more
Source§fn traverse<T, R>(self, relation: R) -> Source<Self, Traverse>where
R: RelationExt<T>,
T: ComponentValue,
fn traverse<T, R>(self, relation: R) -> Source<Self, Traverse>where
R: RelationExt<T>,
T: ComponentValue,
Traverse the edges of a relation recursively to find the first entity which matches the fetch Read more
Source§fn modified(self) -> <Self as TransformFetch<Modified>>::Outputwhere
Self: TransformFetch<Modified>,
fn modified(self) -> <Self as TransformFetch<Modified>>::Outputwhere
Self: TransformFetch<Modified>,
Transform the fetch into a fetch where each constituent part tracks and yields for
modification events. Read more
Source§fn added(self) -> <Self as TransformFetch<Added>>::Outputwhere
Self: TransformFetch<Added>,
fn added(self) -> <Self as TransformFetch<Added>>::Outputwhere
Self: TransformFetch<Added>,
Transform the fetch into a fetch where each constituent part tracks and yields for
component addition events. Read more
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
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