Skip to main content

Query

Struct Query 

Source
pub struct Query<T>
where T: QueryTuple,
{ pub query: NonNull<ecs_query_t>, /* private fields */ }
Expand description

Query for iterating over entities that match a set of conditions.

Queries are the primary way to find and iterate over entities in Flecs. They efficiently match entities based on components, relationships, and other criteria. Queries can be cached for fast repeated iteration or uncached for one-time use.

๐Ÿ“š For comprehensive documentation, see the Flecs Query Manual

ยงCreating Queries

Queries are created using World::new_query() for simple cases or World::query() when you need a builder for complex conditions:

// Simple query - creates cached query immediately
let q1 = world.new_query::<(&Position, &Velocity)>();

// Complex query - use builder for additional conditions
let q2 = world
    .query::<(&Position, &Velocity)>()
    .without(flecs::Prefab)
    .build();

ยงIteration

Queries provide multiple iteration methods:

// Simple iteration over components
query.each(|(pos, vel)| {
    pos.x += vel.x;
});

// Iteration with entity access
query.each_entity(|entity, (pos, vel)| {
    println!("{} at ({}, {})", entity.name(), pos.x, pos.y);
});

// Low-level table iteration for maximum performance
query.run(|mut it| {
    while it.next() {
        let mut pos = it.field_mut::<Position>(0);
        let vel = it.field::<Velocity>(1);
        for i in it.iter() {
            pos[i].x += vel[i].x;
        }
    }
});

ยงCached vs Uncached

Queries can be cached or uncached:

  • Uncached (created with new_query()): Fast creation, slower iteration
  • Cached (created with new_query_named() or explicit cache kind): Slower creation, fast iteration

Use the builderโ€™s set_cache_kind() to control caching behavior:

// Uncached - good for one-off queries
let uncached = world.new_query::<&Position>();

// Cached - good for repeated queries
let cached = world.new_query_named::<&Position>("positions");

// Explicit control
let custom = world
    .query::<&Position>()
    .set_cache_kind(QueryCacheKind::Auto)
    .build();

ยงLifetime and Ownership

Queries are reference-counted and can be cloned cheaply. They remain valid as long as the world exists. Attempting to use a query after its world is destroyed will panic.

let query = world.new_query::<&Position>();
let query_clone = query.clone(); // Cheap - just increments refcount

ยงExamples

ยงReturning Queries from Functions

// The 'static lifetime ensures components live long enough
fn create_foo_query(world: &World) -> Query<&'static Foo> {
    world.new_query::<&Foo>()
}

let query = create_foo_query(&world);
query.each(|foo| { /* ... */ });

ยงComplex Query Conditions

let query = world
    .query::<(&Position, &Velocity)>()
    .with(Enemy)
    .without(flecs::Prefab)
    .build();

ยงSee Also

Fieldsยง

ยงquery: NonNull<ecs_query_t>

Implementationsยง

Sourceยง

impl<T> Query<T>
where T: QueryTuple,

Source

pub unsafe fn new_from(query: NonNull<ecs_query_t>) -> Self

wraps the query pointer in a new query

ยงSafety

this is unsafe due to the fact that the type of the query is not checked. the user is responsible for ensuring that the query is of the correct type. if not possible, only use .iter functions that do not pass in the components in the callback

ยงArguments
  • query - The query pointer to wrap
Source

pub fn destruct(self)

Destroy a query and its resources.

If the query is used as the parent of subqueries, those subqueries will be orphaned and must be deinitialized as well.

Examples found in repository?
examples/flecs/queries/query_group_by_callbacks.rs (line 161)
75fn main() {
76    let world = World::new();
77
78    // Register components in order so that id for First is lower than Third
79    world.component::<First>();
80    world.component::<Second>();
81    world.component::<Third>();
82
83    // Grouped query
84    let query = world
85        .query::<(&Position,)>()
86        .group_by(Group)
87        // Callback invoked when a new group is created
88        .on_group_create(Some(callback_group_create))
89        // Callback invoked when a group is deleted
90        .on_group_delete(Some(callback_group_delete))
91        .build();
92
93    // Create entities in 6 different tables with 3 group ids
94    world
95        .entity()
96        .add((Group, Third))
97        .set(Position { x: 1.0, y: 1.0 });
98    world
99        .entity()
100        .add((Group, Second))
101        .set(Position { x: 2.0, y: 2.0 });
102    world
103        .entity()
104        .add((Group, First))
105        .set(Position { x: 3.0, y: 3.0 });
106
107    world
108        .entity()
109        .add((Group, Third))
110        .set(Position { x: 4.0, y: 4.0 })
111        .add(Tag);
112    world
113        .entity()
114        .add((Group, Second))
115        .set(Position { x: 5.0, y: 5.0 })
116        .add(Tag);
117    world
118        .entity()
119        .add((Group, First))
120        .set(Position { x: 6.0, y: 6.0 })
121        .add(Tag);
122
123    println!();
124
125    // The query cache now looks like this:
126    //  - group First:
127    //     - table [Position, (Group, First)]
128    //     - table [Position, Tag, (Group, First)]
129    //
130    //  - group Second:
131    //     - table [Position, (Group, Second)]
132    //     - table [Position, Tag, (Group, Second)]
133    //
134    //  - group Third:
135    //     - table [Position, (Group, Third)]
136    //     - table [Position, Tag, (Group, Third)]
137    //
138
139    query.run(|mut it| {
140        while it.next() {
141            let group = world.entity_from_id(it.group_id());
142            let pos = it.field::<Position>(0);
143
144            let ctx = unsafe { &*(query.group_context(group) as *mut GroupCtx) };
145            println!(
146                "Group: {:?} - Table: [{:?}] - Counter: {}",
147                group.path().unwrap(),
148                it.archetype(),
149                ctx.counter
150            );
151
152            for i in it.iter() {
153                println!(" [{:?}]", pos[i]);
154            }
155
156            println!();
157        }
158    });
159
160    // Deleting the query will call the on_group_deleted callback
161    query.destruct();
162
163    // Output:
164    //  Group created: "Third"
165    //  Group created: "Second"
166    //  Group created: "First"
167    //
168    //  Group: "::First" - Table: [Position, (Group,First)] - Counter: 3
169    //   [Position { x: 3.0, y: 3.0 }]
170    //
171    //  Group: "::First" - Table: [Position, Tag, (Group,First)] - Counter: 3
172    //   [Position { x: 6.0, y: 6.0 }]
173    //
174    //  Group: "::Second" - Table: [Position, (Group,Second)] - Counter: 2
175    //   [Position { x: 2.0, y: 2.0 }]
176    //
177    //  Group: "::Second" - Table: [Position, Tag, (Group,Second)] - Counter: 2
178    //   [Position { x: 5.0, y: 5.0 }]
179    //
180    //  Group: "::Third" - Table: [Position, (Group,Third)] - Counter: 1
181    //   [Position { x: 1.0, y: 1.0 }]
182    //
183    //  Group: "::Third" - Table: [Position, Tag, (Group,Third)] - Counter: 1
184    //   [Position { x: 4.0, y: 4.0 }]
185    //
186    //  Group deleted: "Second"
187    //  Group deleted: "First"
188    //  Group deleted: "Third"
189}
Source

pub fn reference_count(&self) -> i32

Source

pub fn get_iter_raw(&mut self) -> ecs_iter_t

Get the iterator for the query

ยงArguments
  • world - The world to get the iterator for
Source

pub fn is_changed(&self) -> bool

Returns whether the query data changed since the last iteration.

This operation must be invoked before obtaining the iterator, as this will reset the changed state.

ยงReturns

The operation will return true after:

  • new entities have been matched with
  • matched entities were deleted
  • matched components were changed

Otherwise, it will return false.

ยงSee also
Examples found in repository?
examples/flecs/queries/query_change_tracking_2.rs (line 88)
24fn main() {
25    let world = World::new();
26
27    // Make Dirty inheritable so that queries can match it on prefabs
28    world
29        .component::<Dirty>()
30        .add_trait::<(flecs::OnInstantiate, flecs::Inherit)>();
31
32    // Create a query that just reads a component. We'll use this query for
33    // change tracking. Change tracking for a query is automatically enabled
34    // when query::changed() is called.
35    // Each query has its own private dirty state which is reset only when the
36    // query is iterated.
37
38    let query_read = world
39        .query::<&Position>()
40        .detect_changes()
41        .set_cached()
42        .build();
43
44    // Create a query that writes the component based on a Dirty state.
45    let query_write = world
46        .query::<(&Dirty, &mut Position)>()
47        .term_at(0)
48        .up_id(id::<flecs::IsA>()) // Only match Dirty from prefab
49        .build();
50
51    // Create two prefabs with a Dirty component. We can use this to share a
52    // single Dirty value for all entities in a table.
53    let prefab_dirty_false = world
54        .prefab_named("prefab_dirty_false")
55        .set(Dirty { value: false });
56
57    let prefab_dirty_true = world
58        .prefab_named("prefab_dirty_true")
59        .set(Dirty { value: true });
60
61    // Create instances of p1 and p2. Because the entities have different
62    // prefabs, they end up in different tables.
63    world
64        .entity_named("e1_dirty_false")
65        .is_a(prefab_dirty_false)
66        .set(Position { x: 10.0, y: 20.0 });
67
68    world
69        .entity_named("e2_dirty_false")
70        .is_a(prefab_dirty_false)
71        .set(Position { x: 30.0, y: 40.0 });
72
73    world
74        .entity_named("e3_dirty_true")
75        .is_a(prefab_dirty_true)
76        .set(Position { x: 40.0, y: 50.0 });
77
78    world
79        .entity_named("e4_dirty_true")
80        .is_a(prefab_dirty_true)
81        .set(Position { x: 50.0, y: 60.0 });
82
83    // We can use the changed() function on the query to check if any of the
84    // tables it is matched with has changed. Since this is the first time that
85    // we check this and the query is matched with the tables we just created,
86    // the function will return true.
87    println!();
88    println!("query_read.is_changed(): {}", query_read.is_changed());
89    println!();
90
91    // The changed state will remain true until we have iterated each table.
92    query_read.run(|mut iter| {
93        while iter.next() {
94            // With the it.changed() function we can check if the table we're
95            // currently iterating has changed since last iteration.
96            // Because this is the first time the query is iterated, all tables
97            // will show up as changed.
98            println!(
99                "iiter.is_changed() for table [{}]: {}",
100                iter.archetype().unwrap(),
101                iter.is_changed()
102            );
103        }
104    });
105
106    // Now that we have iterated all tables, the dirty state is reset.
107    println!();
108    println!("query_read.is_changed(): {:?}", query_read.is_changed());
109    println!();
110
111    // Iterate the write query. Because the Position term is InOut (default)
112    // iterating the query will write to the dirty state of iterated tables.
113    query_write.run(|mut it| {
114        while it.next() {
115            let dirty = it.field::<Dirty>(0);
116            let mut pos = it.field_mut::<Position>(1);
117
118            println!("iterate table [{}]", it.archetype().unwrap());
119
120            // Because we enforced that Dirty is a shared component, we can check
121            // a single value for the entire table.
122            if !dirty[0].value {
123                println!("iter.skip() for table [{}]", it.archetype().unwrap());
124
125                // If the dirty flag is false, skip the table. This way the table's
126                // dirty state is not updated by the query.
127                dirty.drop();
128                pos.drop();
129                it.skip();
130
131                continue;
132            }
133
134            // For all other tables the dirty state will be set.
135            for i in it.iter() {
136                pos[i].x += 1.0;
137                pos[i].y += 1.0;
138            }
139        }
140    });
141
142    // One of the tables has changed, so q_read.changed() will return true
143    println!();
144    println!("query_read.is_changed(): {}", query_read.is_changed());
145    println!();
146
147    // When we iterate the read query, we'll see that one table has changed.
148    query_read.run(|mut iter| {
149        while iter.next() {
150            println!(
151                "iter.is_changed() for table [{}]: {}",
152                iter.archetype().unwrap(),
153                iter.is_changed()
154            );
155        }
156    });
157    println!();
158
159    // Output:
160    //  query_read.is_changed(): true
161    //
162    //  iiter.is_changed() for table [Position, (Identifier,Name), (IsA,prefab_dirty_false)]: true
163    //  iiter.is_changed() for table [Position, (Identifier,Name), (IsA,prefab_dirty_true)]: true
164    //
165    //  query_read.is_changed(): false
166    //
167    //  iterate table [Position, (Identifier,Name), (IsA,prefab_dirty_false)]
168    //  iter.skip() for table [Position, (Identifier,Name), (IsA,prefab_dirty_false)]
169    //  iterate table [Position, (Identifier,Name), (IsA,prefab_dirty_true)]
170    //
171    //  query_read.is_changed(): true
172    //
173    //  iter.is_changed() for table [Position, (Identifier,Name), (IsA,prefab_dirty_false)]: false
174    //  iter.is_changed() for table [Position, (Identifier,Name), (IsA,prefab_dirty_true)]: true
175}
Source

pub fn group_info( &self, group_id: impl Into<Entity>, ) -> *const ecs_query_group_info_t

Get info for group

ยงArguments
  • group_id - The group id to get info for
ยงReturns

Returns a pointer to the group info

Source

pub fn group_context(&self, group_id: impl Into<Entity>) -> *mut c_void

Get context for group

ยงArguments
  • group_id - The group id to get context for
ยงReturns

Returns a (void) pointer to the group context

Examples found in repository?
examples/flecs/queries/query_group_by_callbacks.rs (line 144)
75fn main() {
76    let world = World::new();
77
78    // Register components in order so that id for First is lower than Third
79    world.component::<First>();
80    world.component::<Second>();
81    world.component::<Third>();
82
83    // Grouped query
84    let query = world
85        .query::<(&Position,)>()
86        .group_by(Group)
87        // Callback invoked when a new group is created
88        .on_group_create(Some(callback_group_create))
89        // Callback invoked when a group is deleted
90        .on_group_delete(Some(callback_group_delete))
91        .build();
92
93    // Create entities in 6 different tables with 3 group ids
94    world
95        .entity()
96        .add((Group, Third))
97        .set(Position { x: 1.0, y: 1.0 });
98    world
99        .entity()
100        .add((Group, Second))
101        .set(Position { x: 2.0, y: 2.0 });
102    world
103        .entity()
104        .add((Group, First))
105        .set(Position { x: 3.0, y: 3.0 });
106
107    world
108        .entity()
109        .add((Group, Third))
110        .set(Position { x: 4.0, y: 4.0 })
111        .add(Tag);
112    world
113        .entity()
114        .add((Group, Second))
115        .set(Position { x: 5.0, y: 5.0 })
116        .add(Tag);
117    world
118        .entity()
119        .add((Group, First))
120        .set(Position { x: 6.0, y: 6.0 })
121        .add(Tag);
122
123    println!();
124
125    // The query cache now looks like this:
126    //  - group First:
127    //     - table [Position, (Group, First)]
128    //     - table [Position, Tag, (Group, First)]
129    //
130    //  - group Second:
131    //     - table [Position, (Group, Second)]
132    //     - table [Position, Tag, (Group, Second)]
133    //
134    //  - group Third:
135    //     - table [Position, (Group, Third)]
136    //     - table [Position, Tag, (Group, Third)]
137    //
138
139    query.run(|mut it| {
140        while it.next() {
141            let group = world.entity_from_id(it.group_id());
142            let pos = it.field::<Position>(0);
143
144            let ctx = unsafe { &*(query.group_context(group) as *mut GroupCtx) };
145            println!(
146                "Group: {:?} - Table: [{:?}] - Counter: {}",
147                group.path().unwrap(),
148                it.archetype(),
149                ctx.counter
150            );
151
152            for i in it.iter() {
153                println!(" [{:?}]", pos[i]);
154            }
155
156            println!();
157        }
158    });
159
160    // Deleting the query will call the on_group_deleted callback
161    query.destruct();
162
163    // Output:
164    //  Group created: "Third"
165    //  Group created: "Second"
166    //  Group created: "First"
167    //
168    //  Group: "::First" - Table: [Position, (Group,First)] - Counter: 3
169    //   [Position { x: 3.0, y: 3.0 }]
170    //
171    //  Group: "::First" - Table: [Position, Tag, (Group,First)] - Counter: 3
172    //   [Position { x: 6.0, y: 6.0 }]
173    //
174    //  Group: "::Second" - Table: [Position, (Group,Second)] - Counter: 2
175    //   [Position { x: 2.0, y: 2.0 }]
176    //
177    //  Group: "::Second" - Table: [Position, Tag, (Group,Second)] - Counter: 2
178    //   [Position { x: 5.0, y: 5.0 }]
179    //
180    //  Group: "::Third" - Table: [Position, (Group,Third)] - Counter: 1
181    //   [Position { x: 1.0, y: 1.0 }]
182    //
183    //  Group: "::Third" - Table: [Position, Tag, (Group,Third)] - Counter: 1
184    //   [Position { x: 4.0, y: 4.0 }]
185    //
186    //  Group deleted: "Second"
187    //  Group deleted: "First"
188    //  Group deleted: "Third"
189}

Trait Implementationsยง

Sourceยง

impl<T> Clone for Query<T>
where T: QueryTuple,

Sourceยง

fn clone(&self) -> Self

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) ยท Sourceยง

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Sourceยง

impl<T> Drop for Query<T>
where T: QueryTuple,

Sourceยง

fn drop(&mut self)

Executes the destructor for this type. Read more
Sourceยง

fn pin_drop(self: Pin<&mut Self>)

๐Ÿ”ฌThis is a nightly-only experimental API. (pin_ergonomics)
Execute the destructor for this type, but different to Drop::drop, it requires self to be pinned. Read more
Sourceยง

impl<T: QueryTuple> From<&Query<T>> for NonNull<ecs_query_t>

Sourceยง

fn from(q: &Query<T>) -> Self

Converts to this type from the input type.
Sourceยง

impl<T> From<Query<T>> for Entity
where T: QueryTuple,

Sourceยง

fn from(query: Query<T>) -> Self

Converts to this type from the input type.
Sourceยง

impl<T> IterOperations for Query<T>
where T: QueryTuple,

Sourceยง

impl<T> QueryAPI<'_, (), T> for Query<T>
where T: QueryTuple,

Sourceยง

fn entity(&self) -> EntityView<'_>

Get the entity of the current query Read more
Sourceยง

fn each(&self, func: impl FnMut(T::TupleType<'_>))

Each iterator. The โ€œeachโ€ iterator accepts a function that is invoked for each matching entity. The following function signatures is valid: Read more
Sourceยง

unsafe fn each_unchecked(&self, func: impl FnMut(T::TupleType<'_>))

Each iterator without aliasing checks. Read more
Sourceยง

fn each_internal<const CHECKED: bool>(&self, func: impl FnMut(T::TupleType<'_>))

Internal implementation for both checked and unchecked each iteration.
Sourceยง

fn each_entity(&self, func: impl FnMut(EntityView<'_>, T::TupleType<'_>))

Each iterator. The โ€œeachโ€ iterator accepts a function that is invoked for each matching entity. The following function signatures is valid: Read more
Sourceยง

unsafe fn each_entity_unchecked( &self, func: impl FnMut(EntityView<'_>, T::TupleType<'_>), )

Each entity iterator without aliasing checks. Read more
Sourceยง

fn each_entity_internal<const CHECKED: bool>( &self, func: impl FnMut(EntityView<'_>, T::TupleType<'_>), )

Internal implementation for both checked and unchecked each_entity iteration.
Sourceยง

fn each_iter( &self, func: impl FnMut(TableIter<'_, false, P>, FieldIndex, T::TupleType<'_>), )
where P: ComponentId,

Each iterator. This variant of each provides access to the TableIter object, which contains more information about the object being iterated. The usize argument contains the index of the entity being iterated, which can be used to obtain entity-specific data from the TableIter object. Read more
Sourceยง

unsafe fn each_iter_unchecked( &self, func: impl FnMut(TableIter<'_, false, P>, FieldIndex, T::TupleType<'_>), )
where P: ComponentId,

Each iterator without aliasing checks. Read more
Sourceยง

fn each_iter_internal<const CHECKED: bool>( &self, func: impl FnMut(TableIter<'_, false, P>, FieldIndex, T::TupleType<'_>), )
where P: ComponentId,

Internal implementation for both checked and unchecked each_iter iteration.
Sourceยง

fn find( &self, func: impl FnMut(T::TupleType<'_>) -> bool, ) -> Option<EntityView<'a>>

find iterator to find an entity The โ€œfindโ€ iterator accepts a function that is invoked for each matching entity and checks if the condition is true. if it is, it returns that entity. The following function signatures is valid: Read more
Sourceยง

fn find_entity( &self, func: impl FnMut(EntityView<'_>, T::TupleType<'_>) -> bool, ) -> Option<EntityView<'a>>

find iterator to find an entity The โ€œfindโ€ iterator accepts a function that is invoked for each matching entity and checks if the condition is true. if it is, it returns that entity. The following function signatures is valid: Read more
Sourceยง

fn run(&self, func: impl FnMut(TableIter<'_, true, P>))
where P: ComponentId,

Run iterator. Read more
Sourceยง

fn run_each<FuncEach>( &self, func: impl FnMut(TableIter<'_, true, P>), func_each: FuncEach, )
where P: ComponentId, FuncEach: FnMut(T::TupleType<'_>),

Run iterator with each forwarding. The โ€œiterโ€ iterator accepts a function that is invoked for each matching table. The following function signature is valid: Read more
Sourceยง

fn run_each_entity<FuncEachEntity>( &self, func: impl FnMut(TableIter<'_, true, P>), func_each: FuncEachEntity, )
where P: ComponentId, FuncEachEntity: FnMut(EntityView<'_>, T::TupleType<'_>),

Run iterator with each entity forwarding. Read more
Sourceยง

fn run_each_iter<FuncEachIter>( &self, func: impl FnMut(TableIter<'_, true, P>), func_each: FuncEachIter, )
where P: ComponentId, FuncEachIter: FnMut(TableIter<'_, false, P>, FieldIndex, T::TupleType<'_>),

Each iterator. This variant of each provides access to the TableIter object, which contains more information about the object being iterated. The usize argument contains the index of the entity being iterated, which can be used to obtain entity-specific data from the TableIter object. Read more
Sourceยง

fn each_term(&self, func: impl FnMut(&TermRef<'_>))

Each term iterator. The each_term iterator accepts a function that is invoked for each term in the query. The following function signature is valid: Read more
Sourceยง

fn term(&self, index: usize) -> TermRef<'_>

Get a immutable reference of the term of the current query at the given index This is mostly used for debugging purposes. Read more
Sourceยง

fn field_count(&self) -> i8

Get the field count of the current query Read more
Sourceยง

fn term_count(&self) -> u32

Get the count of terms set of the current query
Sourceยง

fn to_string(&self) -> String

Convert query to string expression. Convert query terms to a string expression. The resulting expression can be parsed to create the same query. Read more
Sourceยง

fn find_var(&self, name: &str) -> Option<i32>

Sourceยง

fn plan(&self) -> String

Sourceยง

fn iterable(&self) -> QueryIter<'_, P, T>

Sourceยง

fn iter_stage(&'a self, stage: impl WorldProvider<'a>) -> QueryIter<'a, P, T>

Sourceยง

fn try_first_entity(&self) -> Option<EntityView<'a>>

Return first matching entity. Read more
Sourceยง

fn first_entity(&self) -> EntityView<'a>

Return first matching entity. Read more
Sourceยง

fn try_first<R>(&self, func: impl FnOnce(T::TupleType<'_>) -> R) -> Option<R>

iterates over the first entity in the iterator and returns a user-defined result. Read more
Sourceยง

fn first<R>(&self, func: impl FnOnce(T::TupleType<'_>) -> R) -> R

iterates over the first entity in the iterator and returns a user-defined result. Read more
Sourceยง

fn try_first_only<R>( &self, func: impl FnOnce(T::TupleType<'_>) -> R, ) -> Result<R, FirstOnlyError>

Iterates over the first entity in the iterator and returns a user-defined result. Read more
Sourceยง

fn first_only<R>(&self, func: impl FnOnce(T::TupleType<'_>) -> R) -> R

iterates over the first entity in the iterator and returns a user-defined result. Read more
Sourceยง

fn is_true(&mut self) -> bool

Returns true if iterator yields at least once result.
Sourceยง

fn count(&self) -> i32

Return total number of entities in result. Read more
Sourceยง

fn set_group(&self, group_id: impl IntoEntity) -> QueryIter<'_, P, T>

Limit results to tables with specified group id (grouped queries only) Read more
Sourceยง

fn set_var(&self, var_id: i32, value: impl Into<Entity>) -> QueryIter<'_, P, T>

set variable of iter Read more
Sourceยง

fn set_var_table( &self, var_id: i32, table: impl IntoTableRange, ) -> QueryIter<'_, P, T>

set variable of iter as table Read more
Sourceยง

fn set_var_expr( &self, name: &str, value: impl Into<Entity>, ) -> QueryIter<'_, P, T>

set variable for rule iter Read more
Sourceยง

fn set_var_table_expr( &self, name: &str, table: impl IntoTableRange, ) -> QueryIter<'_, P, T>

set variable for rule iter as table Read more
Sourceยง

fn to_json(&self, desc: Option<&IterToJsonDesc>) -> Option<String>

Available on crate feature flecs_json only.
Serialize iterator result to JSON.
Sourceยง

fn cache_query(&self) -> Option<Query<()>>

Sourceยง

impl<T> Send for Query<T>
where T: QueryTuple,

Sourceยง

impl<T> Sync for Query<T>
where T: QueryTuple,

Sourceยง

impl<'a, T> WorldProvider<'a> for Query<T>
where T: QueryTuple,

Sourceยง

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

Auto Trait Implementationsยง

ยง

impl<T> Freeze for Query<T>
where PhantomData<T>: Freeze,

ยง

impl<T> RefUnwindSafe for Query<T>

ยง

impl<T> Unpin for Query<T>
where PhantomData<T>: Unpin,

ยง

impl<T> UnsafeUnpin for Query<T>

ยง

impl<T> UnwindSafe for Query<T>

Blanket Implementationsยง

Sourceยง

impl<T> AccessArg for T
where T: IntoId, Access: FromAccessArg<T>,

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> CloneToUninit for T
where T: Clone,

Sourceยง

unsafe fn clone_to_uninit(&self, dest: *mut u8)

๐Ÿ”ฌThis is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Sourceยง

impl<'a, T> Doc<'a> for T
where T: Into<Entity> + WorldProvider<'a> + Clone,

Sourceยง

fn doc_name(&self) -> Option<String>

Available on crate feature flecs_doc only.
Get human readable name for an entity. Read more
Sourceยง

fn doc_brief(&self) -> Option<String>

Available on crate feature flecs_doc only.
Get brief description for an entity. Read more
Sourceยง

fn doc_detail(&self) -> Option<String>

Available on crate feature flecs_doc only.
Get detailed description for an entity. Read more
Available on crate feature flecs_doc only.
Get link to external documentation for an entity. Read more
Sourceยง

fn doc_color(&self) -> Option<String>

Available on crate feature flecs_doc only.
Get color for an entity. Read more
Sourceยง

fn doc_uuid(&self) -> Option<String>

Available on crate feature flecs_doc only.
Get UUID for entity Read more
Sourceยง

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

Available on crate feature flecs_doc only.
Add human-readable name to entity. Read more
Sourceยง

fn set_doc_brief(&self, brief: &str) -> &Self

Available on crate feature flecs_doc only.
Add brief description to entity. Read more
Sourceยง

fn set_doc_detail(&self, detail: &str) -> &Self

Available on crate feature flecs_doc only.
Add detailed description to entity. Read more
Available on crate feature flecs_doc only.
Add link to external documentation to entity. Read more
Sourceยง

fn set_doc_color(&self, color: &str) -> &Self

Available on crate feature flecs_doc only.
Add color to entity. Read more
Sourceยง

fn set_doc_uuid(&self, uuid: &str) -> &Self

Available on crate feature flecs_doc only.
Set doc UUID. This adds (flecs.doc.Description, flecs.doc.Uuid) to the entity. 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> IntoEntity for T
where T: Into<Entity>,

Sourceยง

const IS_TYPED_PAIR: bool = const IS_TYPED_PAIR: bool = false;

Sourceยง

const IS_TYPED: bool = const IS_TYPED: bool = false;

Sourceยง

const IF_ID_IS_DEFAULT: bool = const IF_ID_IS_DEFAULT: bool = false;

Sourceยง

const IS_TYPED_SECOND: bool = const IS_TYPED_SECOND: bool = true;

Sourceยง

const IF_ID_IS_DEFAULT_SECOND: bool = const IF_ID_IS_DEFAULT_SECOND: bool = false;

Sourceยง

const IS_ENUM: bool = const IS_ENUM: bool = false;

Sourceยง

const IS_TYPE_TAG: bool = const IS_TYPE_TAG: bool = false;

Sourceยง

const IS_TYPED_REF: bool = const IS_TYPED_REF: bool = false;

Sourceยง

const IS_TYPED_MUT_REF: bool = const IS_TYPED_MUT_REF: bool = false;

Sourceยง

type CastType = c_void

Sourceยง

type IsTyped = FlecsIsNotTyped

Sourceยง

type IsTag = FlecsIsATag

Sourceยง

fn into_entity<'a>(self, _world: impl WorldProvider<'a>) -> Entity

Sourceยง

impl<T> IntoId for T
where T: InternalIntoEntity,

Sourceยง

const IS_PAIR: bool = const IS_PAIR: bool = T::IS_TYPED_PAIR;

Safety Read more
Sourceยง

const IS_ENUM: bool = const IS_ENUM: bool = <T as InternalIntoEntity>::IS_ENUM;

Sourceยง

const IS_TYPE_TAG: bool = const IS_TYPE_TAG: bool = <T as InternalIntoEntity>::IS_TYPE_TAG;

Sourceยง

const IS_TYPED_REF: bool = const IS_TYPED_REF: bool = <T as InternalIntoEntity>::IS_TYPED_REF;

Sourceยง

const IS_TYPED_MUT_REF: bool = const IS_TYPED_MUT_REF: bool = <T as InternalIntoEntity>::IS_TYPED_MUT_REF;

Sourceยง

type CastType = <T as InternalIntoEntity>::CastType

Sourceยง

fn get_id_second<'a>(self, world: impl WorldProvider<'a>) -> Entity

Sourceยง

impl<T> SingleAccessArg for T

Sourceยง

impl<T> ToOwned for T
where T: Clone,

Sourceยง

type Owned = T

The resulting type after obtaining ownership.
Sourceยง

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Sourceยง

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Sourceยง

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Sourceยง

type Error = !

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.