pub trait FetchExt: Sized {
Show 20 methods
// Provided methods
fn opt(self) -> Opt<Self> { ... }
fn opt_or<V>(self, default: V) -> OptOr<Self, V>
where for<'q> Self: for<'w> Fetch<'w> + FetchItem<'q, Item = &'q V> { ... }
fn satisfied(self) -> Satisfied<Self> { ... }
fn opt_or_default<V>(self) -> OptOr<Self, V>
where for<'q> Self: for<'w> Fetch<'w> + FetchItem<'q, Item = &'q V>,
V: Default { ... }
fn cloned(self) -> Cloned<Self>
where Cloned<Self>: for<'x> Fetch<'x> { ... }
fn copied(self) -> Copied<Self>
where Copied<Self>: for<'x> Fetch<'x> { ... }
fn deref(self) -> AsDeref<Self>
where AsDeref<Self>: for<'x> Fetch<'x> { ... }
fn cmp<F>(self, func: F) -> Cmp<Self, F>
where for<'x> Cmp<Self, F>: Fetch<'x> { ... }
fn lt<T>(self, other: T) -> Cmp<Self, Less<T>>
where for<'x> Cmp<Self, Less<T>>: Fetch<'x> { ... }
fn gt<T>(self, other: T) -> Cmp<Self, Greater<T>>
where for<'x> Cmp<Self, GreaterEq<T>>: Fetch<'x> { ... }
fn ge<T>(self, other: T) -> Cmp<Self, GreaterEq<T>>
where for<'x> Cmp<Self, GreaterEq<T>>: Fetch<'x> { ... }
fn le<T>(self, other: T) -> Cmp<Self, LessEq<T>>
where for<'x> Cmp<Self, LessEq<T>>: Fetch<'x> { ... }
fn eq<T>(self, other: T) -> Cmp<Self, Equal<T>>
where for<'x> Cmp<Self, Equal<T>>: Fetch<'x> { ... }
fn source<S>(self, source: S) -> Source<Self, S>
where S: FetchSource { ... }
fn relation<T, R>(self, relation: R) -> Source<Self, FromRelation>
where R: RelationExt<T>,
T: ComponentValue { ... }
fn traverse<T, R>(self, relation: R) -> Source<Self, Traverse>
where R: RelationExt<T>,
T: ComponentValue { ... }
fn modified(self) -> <Self as TransformFetch<Modified>>::Output
where Self: TransformFetch<Modified> { ... }
fn added(self) -> <Self as TransformFetch<Added>>::Output
where Self: TransformFetch<Added> { ... }
fn map<F, T>(self, func: F) -> Map<Self, F>
where Self: for<'x> FetchItem<'x>,
for<'x> F: Fn(<Self as FetchItem<'x>>::Item) -> T { ... }
fn filtered<F>(self, filter: F) -> Filtered<Self, F>
where F: for<'x> Fetch<'x> { ... }
}
Expand description
Extension trait for crate::Fetch
Provided Methods§
Sourcefn 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.
Sourcefn satisfied(self) -> Satisfied<Self>
fn satisfied(self) -> Satisfied<Self>
Returns true if the query is satisfied, without borrowing
Sourcefn 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.
Sourcefn 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
Sourcefn 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
.
Sourcefn 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
.
Sourcefn 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.
This allows fetching or joining queries
Sourcefn 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.
This allows you to for example fetch from the parent of an entity.
Sourcefn 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
This will attempt to resolve a fetch from and including the source entity, to the roots of the relation.
Sourcefn 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.
This is different from E.g; (a().modified(), b().modified())
as it implies only when
both a
and b
are modified in the same iteration, which is seldom useful.
This means will yield any of a
or b
are modified.
Works with opt
, copy
, etc constituents.
Sourcefn 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.
This is different from E.g; (a().modified(), b().modified())
as it implies only when
both a
and b
are modified in the same iteration, which is seldom useful.
This means will yield any of a
or b
are modified.
Works with opt
, copy
, etc constituents.
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.