Struct QueryBuilder

Source
pub struct QueryBuilder<'a, T>
where T: QueryTuple,
{ /* private fields */ }
Expand description

Fast to iterate, but slower to create than Filter

Implementations§

Source§

impl<'a, T> QueryBuilder<'a, T>
where T: QueryTuple,

Source

pub fn new(world: &'a World) -> Self

Create a new query builder

§Arguments
  • world - The world to create the observer in

See also

  • C++ API: builder::builder
Source

pub fn new_named(world: &'a World, name: &str) -> Self

Create a new query builder with a name

§Arguments
  • world - The world to create the observer in
  • name - The name of the observer

See also

  • C++ API: query_builder::query_builder

Trait Implementations§

Source§

impl<'a, T: QueryTuple> QueryBuilderImpl<'a> for QueryBuilder<'a, T>

Source§

fn named(&mut self, name: &str) -> &mut Self

set the name of the query-like object
Source§

fn instanced(&mut self) -> &mut Self

set itself to be instanced Read more
Source§

fn query_flags(&mut self, flags: QueryFlags) -> &mut Self

set querylags Read more
Source§

fn set_cache_kind(&mut self, kind: QueryCacheKind) -> &mut Self

Set what cache method to use for the query Read more
Source§

fn set_cached(&mut self) -> &mut Self

Set the cache method to cached Read more
Source§

fn expr(&mut self, expr: &'a str) -> &mut Self

set expression Read more
Source§

fn with_id(&mut self, id: impl IntoId) -> &mut Self

set term with Id Read more
Source§

fn with<T: ComponentOrPairId>(&mut self) -> &mut Self

set term with type Read more
Source§

fn with_enum<T: ComponentId + ComponentType<Enum> + EnumComponentInfo>( &mut self, value: T, ) -> &mut Self

set term with enum Read more
Source§

fn with_enum_wildcard<T: ComponentType<Enum> + ComponentId>( &mut self, ) -> &mut Self

set term with enum wildcard Read more
Source§

fn with_first<First: ComponentId>( &mut self, second: impl Into<Entity> + Copy, ) -> &mut Self

set term with pairs Read more
Source§

fn with_first_name<First: ComponentId>(&mut self, second: &'a str) -> &mut Self

set term with pairs Read more
Source§

fn with_second<Second: ComponentId>( &mut self, first: impl Into<Entity> + Copy, ) -> &mut Self

set term with pairs Read more
Source§

fn with_second_name<Second: ComponentId>(&mut self, first: &'a str) -> &mut Self

set term with pairs Read more
Source§

fn with_name(&mut self, name: &'a str) -> &mut Self

set term with Name Read more
Source§

fn with_names(&mut self, first: &'a str, second: &'a str) -> &mut Self

set term with pair names Read more
Source§

fn with_first_id( &mut self, first: impl Into<Entity>, second: &'a str, ) -> &mut Self

set term with first id and second name
Source§

fn with_second_id( &mut self, first: &'a str, second: impl Into<Entity>, ) -> &mut Self

set term with second id and first name
Source§

fn without_id(&mut self, id: impl IntoId) -> &mut Self

set term without Id Read more
Source§

fn without<T: ComponentOrPairId>(&mut self) -> &mut Self

set term without type Read more
Source§

fn without_enum<T: ComponentId + ComponentType<Enum> + EnumComponentInfo>( &mut self, value: T, ) -> &mut Self

set term without enum Read more
Source§

fn without_enum_wildcard<T: ComponentId + ComponentType<Enum> + EnumComponentInfo>( &mut self, ) -> &mut Self

set term without enum wildcard Read more
Source§

fn without_first<First: ComponentId>( &mut self, second: impl Into<Entity> + Copy, ) -> &mut Self

set term without pairs Read more
Source§

fn without_first_name<First: ComponentId>( &mut self, second: &'a str, ) -> &mut Self

set term without pairs Read more
Source§

fn without_second<Second: ComponentId>( &mut self, first: impl Into<Entity> + Copy, ) -> &mut Self

set term without pairs Read more
Source§

fn without_second_name<Second: ComponentId>( &mut self, first: &'a str, ) -> &mut Self

set term without pairs Read more
Source§

fn without_name(&mut self, name: &'a str) -> &mut Self

set term without Name Read more
Source§

fn without_names(&mut self, first: &'a str, second: &'a str) -> &mut Self

set term without pair names Read more
Source§

fn without_first_id( &mut self, first: impl Into<Entity>, second: &'a str, ) -> &mut Self

set term without first id and second name Read more
Source§

fn without_second_id( &mut self, first: &'a str, second: impl Into<Entity>, ) -> &mut Self

set term without second id and first name Read more
Source§

fn term(&mut self) -> &mut Self

Term notation for more complex query features Read more
Source§

fn term_at(&mut self, index: u32) -> &mut Self

Term notation for more complex query features Read more
Source§

fn write<T: ComponentOrPairId>(&mut self) -> &mut Self

Set the type as current term and in mode out
Source§

fn write_id(&mut self, id: impl IntoId) -> &mut Self

Set the id as current term and in mode out
Source§

fn write_name(&mut self, name: &'a str) -> &mut Self

Set the name as current term and in mode out
Source§

fn write_names(&mut self, first: &'a str, second: &'a str) -> &mut Self

Set the names as current term and in mode out
Source§

fn write_enum<T: ComponentId + ComponentType<Enum> + EnumComponentInfo>( &mut self, value: T, ) -> &mut Self

Set the type as current term and in mode out
Source§

fn write_first<T: ComponentId>( &mut self, second: impl Into<Entity> + Copy, ) -> &mut Self

Set the relationship as current term and in mode out
Source§

fn write_first_name<T: ComponentId>(&mut self, second: &'a str) -> &mut Self

Set the relationship as current term and in mode out
Source§

fn write_second<T: ComponentId>( &mut self, first: impl Into<Entity> + Copy, ) -> &mut Self

Set the relationship as current term and in mode out
Source§

fn write_second_name<T: ComponentId>(&mut self, first: &'a str) -> &mut Self

Set the relationship as current term and in mode out
Source§

fn read<T: ComponentOrPairId>(&mut self) -> &mut Self

Set the type as current term and in mode in
Source§

fn read_id(&mut self, id: impl IntoId) -> &mut Self

Set the id as current term and in mode in
Source§

fn read_name(&mut self, name: &'a str) -> &mut Self

Set the name as current term and in mode in
Source§

fn read_names(&mut self, first: &'a str, second: &'a str) -> &mut Self

Set the names as current term and in mode in
Source§

fn read_enum<T: ComponentId + ComponentType<Enum> + EnumComponentInfo>( &mut self, value: T, ) -> &mut Self

Set the type as current term and in mode in
Source§

fn read_first<T: ComponentId>( &mut self, second: impl Into<Entity> + Copy, ) -> &mut Self

Set the relationship as current term and in mode in
Source§

fn read_first_name<T: ComponentId>(&mut self, second: &'a str) -> &mut Self

Set the relationship as current term and in mode in
Source§

fn read_second<T: ComponentId>( &mut self, first: impl Into<Entity> + Copy, ) -> &mut Self

Set the relationship as current term and in mode in
Source§

fn read_second_name<T: ComponentId>(&mut self, first: &'a str) -> &mut Self

Set the relationship as current term and in mode in
Source§

fn scope_open(&mut self) -> &mut Self

Open a scope for the query
Source§

fn scope_close(&mut self) -> &mut Self

Close a scope for the query
Source§

fn order_by<T>(&mut self, compare: impl OrderByFn<T>) -> &mut Self
where T: ComponentId, Self: QueryBuilderImpl<'a>,

Sorts the output of a query. Read more
Source§

fn order_by_id( &mut self, component: impl Into<Entity>, compare: impl OrderByFnVoid, ) -> &mut Self

Sorts the output of a query. Read more
Source§

fn group_by<T>(&mut self) -> &mut Self
where T: ComponentId,

Group and sort matched tables. Read more
Source§

fn group_by_fn<T>( &mut self, group_by_action: ecs_group_by_action_t, ) -> &mut Self
where T: ComponentId,

Group and sort matched tables. Read more
Source§

fn group_by_id_fn( &mut self, component: impl Into<Entity>, group_by_action: ecs_group_by_action_t, ) -> &mut Self

Group and sort matched tables. Read more
Source§

fn group_by_id(&mut self, component: impl Into<Entity>) -> &mut Self

Group and sort matched tables. Read more
Source§

fn group_by_ctx( &mut self, ctx: *mut c_void, ctx_free: ecs_ctx_free_t, ) -> &mut Self

Specify context to be passed to the group_by function. Read more
Source§

fn on_group_create(&mut self, action: ecs_group_create_action_t) -> &mut Self

Specify the on_group_create action. Read more
Source§

fn on_group_delete(&mut self, action: ecs_group_delete_action_t) -> &mut Self

Specify the on_group_delete action. Read more
Source§

impl<'a, T: QueryTuple> TermBuilderImpl<'a> for QueryBuilder<'a, T>

Source§

fn init_current_term<T>(&mut self, id: T)
where T: IntoId,

initializes a new term from a id of a component or pair Read more
Source§

fn init_term_from<T: ComponentOrPairId>(&mut self)

initialize a new term from a component or pair Read more
Source§

fn reset(&mut self)

Reset the term Read more
Source§

fn is_set(&mut self) -> bool

Check if term is initialized Read more
Source§

fn id(&self) -> Id

Get the term id of the current term set Read more
Source§

fn inout(&self) -> InOutKind

Get the inout type of term of the current term set Read more
Source§

fn oper(&self) -> OperKind

Get the operator of term of the current term set Read more
Source§

fn src_id(&self) -> Entity

Get the src id of term of the current term set Read more
Source§

fn first_id(&self) -> Entity

Get the first of term of the current term set Read more
Source§

fn second_id(&self) -> Entity

Get the second of term of the current term set Read more
Source§

fn self_(&mut self) -> &mut Self

The self flag indicates the term identifier itself is used Read more
Source§

fn set_id(&mut self, id: impl Into<Entity>) -> &mut Self

Specify value of identifier by id, same as id() of the current term set Read more
Source§

fn entity(&mut self, entity: impl Into<Entity>) -> &mut Self

Specify value of identifier by id. Almost the same as id(entity), but this operation explicitly sets the flecs::IsEntity flag. This forces the id to be interpreted as entity, whereas not setting the flag would implicitly convert ids for builtin variables such as flecs::This to a variable. Read more
Source§

fn name(&mut self, name: &'a str) -> &mut Self

Specify value of identifier by name Read more
Source§

fn set_var(&mut self, var_name: &'a str) -> &mut Self

Specify identifier is a variable (resolved at query evaluation time) Read more
Source§

fn flags(&mut self, flags: u64) -> &mut Self

Override term id flags Read more
Source§

fn src(&mut self) -> &mut Self

Call prior to setting values for src identifier Read more
Source§

fn first(&mut self) -> &mut Self

Call prior to setting values for first identifier. This is either the component identifier, or first element of a pair (in case second is populated as well). Read more
Source§

fn second(&mut self) -> &mut Self

Call prior to setting values for second identifier. This is the second element of a pair. Requires that first() is populated as well. Read more
Source§

fn set_src_id(&mut self, id: impl Into<Entity>) -> &mut Self

Select src identifier, initialize it with entity id Read more
Source§

fn set_src<T: ComponentId>(&mut self) -> &mut Self

Select src identifier, initialize it with id associated with type Read more
Source§

fn set_src_name(&mut self, name: &'a str) -> &mut Self

Select src identifier, initialize it with name. If name starts with a $ the name is interpreted as a variable. Read more
Source§

fn set_first_id(&mut self, id: impl Into<Entity>) -> &mut Self

Select first identifier, initialize it with entity id Read more
Source§

fn set_first<T: ComponentId>(&mut self) -> &mut Self

Select first identifier, initialize it with id associated with type Read more
Source§

fn set_first_name(&mut self, name: &'a str) -> &mut Self

Select first identifier, initialize it with name. If name starts with a $ the name is interpreted as a variable. Read more
Source§

fn set_second_id(&mut self, id: impl Into<Entity>) -> &mut Self

Select second identifier, initialize it with entity id Read more
Source§

fn set_second<T: ComponentId>(&mut self) -> &mut Self

Select second identifier, initialize it with id associated with type Read more
Source§

fn set_second_name(&mut self, name: &'a str) -> &mut Self

Select second identifier, initialize it with name. If name starts with a $ the name is interpreted as a variable. Read more
Source§

fn up(&mut self) -> &mut Self

default up where trav is set to 0. The up flag indicates that the term identifier may be substituted by traversing a relationship upwards. For example: substitute the identifier with its parent by traversing the ChildOf relationship. Read more
Source§

fn parent(&mut self) -> &mut Self

same as up Read more
Source§

fn up_id(&mut self, traverse_relationship: impl Into<Entity>) -> &mut Self

The up flag indicates that the term identifier may be substituted by traversing a relationship upwards. For example: substitute the identifier with its parent by traversing the ChildOf relationship. Read more
Source§

fn up_type<TravRel: ComponentId>(&mut self) -> &mut Self

The up flag indicates that the term identifier may be substituted by traversing a relationship upwards. For example: substitute the identifier with its parent by traversing the ChildOf relationship. Read more
Source§

fn cascade(&mut self) -> &mut Self

Cascade iterates a hierarchy in top to bottom order (breadth first search) The cascade flag is like up, but returns results in breadth-first order. Only supported for flecs::query. Read more
Source§

fn cascade_id(&mut self, traverse_relationship: impl Into<Entity>) -> &mut Self

Cascade iterates a hierarchy in top to bottom order (breadth first search) The cascade flag is like up, but returns results in breadth-first order. Only supported for flecs::query Read more
Source§

fn cascade_type<TravRel: ComponentId>(&mut self) -> &mut Self

Cascade iterates a hierarchy in top to bottom order (breadth first search) The cascade flag is like up, but returns results in breadth-first order. Only supported for flecs::query Read more
Source§

fn desc(&mut self) -> &mut Self

Use with cascade to iterate results in descending (bottom + top) order.
Source§

fn trav( &mut self, traverse_relationship: impl Into<Entity>, flags: u64, ) -> &mut Self

Specify relationship to traverse, and flags to indicate direction Read more
Source§

fn id_flags(&mut self, flags: impl IntoId) -> &mut Self

Set id flags for term. Read more
Source§

fn set_inout_kind(&mut self, inout: InOutKind) -> &mut Self

Set read/write access of term Read more
Source§

fn inout_stage(&mut self, inout: InOutKind) -> &mut Self

Set read/write access for stage. Use this when a system reads or writes components other than the ones provided by the query. This information can be used by schedulers to insert sync/merge points between systems where deferred operations are flushed. Read more
Source§

fn write_curr(&mut self) -> &mut Self

Set write mode on current term. Short for inout_stage(InOutKind::Out). Use when system uses add, remove or set. Read more
Source§

fn read_curr(&mut self) -> &mut Self

Set read mode on current term. Short for inout_stage(InOutKind::In). Use when system uses get Read more
Source§

fn read_write(&mut self) -> &mut Self

Short for inout_stage(InOutKind::InOut). Use when system uses ensure Read more
Source§

fn set_in(&mut self) -> &mut Self

short for set_inout(InOutKind::In) Read more
Source§

fn set_out(&mut self) -> &mut Self

short for set_inout(InOutKind::Out) Read more
Source§

fn set_inout(&mut self) -> &mut Self

short for set_inout(InOutKind::InOut) Read more
Source§

fn set_inout_none(&mut self) -> &mut Self

short for set_inout(InOutKind::None) Read more
Source§

fn set_oper(&mut self, oper: OperKind) -> &mut Self

set operator of term Read more
Source§

fn and(&mut self) -> &mut Self

short for set_oper(OperKind::And) Read more
Source§

fn or(&mut self) -> &mut Self

short for set_oper(OperKind::Or) Read more
Source§

fn not(&mut self) -> &mut Self

short for set_oper(OperKind::Not) Read more
Source§

fn optional(&mut self) -> &mut Self

short for set_oper(OperKind::Optional) Read more
Source§

fn and_from(&mut self) -> &mut Self

short for set_oper(OperKind::AndFrom) Read more
Source§

fn or_from(&mut self) -> &mut Self

short for set_oper(OperKind::OrFrom) Read more
Source§

fn not_from(&mut self) -> &mut Self

short for set_oper(OperKind::NotFrom) Read more
Source§

fn singleton(&mut self) -> &mut Self

Match singleton Read more
Source§

fn filter(&mut self) -> &mut Self

Query terms are not triggered on by observers Read more
Source§

impl<'a, T: QueryTuple> WorldProvider<'a> for QueryBuilder<'a, T>

Source§

fn world(&self) -> WorldRef<'a>

Auto Trait Implementations§

§

impl<'a, T> Freeze for QueryBuilder<'a, T>

§

impl<'a, T> RefUnwindSafe for QueryBuilder<'a, T>
where T: RefUnwindSafe,

§

impl<'a, T> !Send for QueryBuilder<'a, T>

§

impl<'a, T> !Sync for QueryBuilder<'a, T>

§

impl<'a, T> Unpin for QueryBuilder<'a, T>
where T: Unpin,

§

impl<'a, T> UnwindSafe for QueryBuilder<'a, 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
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> DoesNotImpl for T

Source§

const IMPLS: bool = false

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.