Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion crates/bevy_ecs/src/query/fetch.rs
Original file line number Diff line number Diff line change
Expand Up @@ -406,7 +406,7 @@ pub unsafe trait QueryData: WorldQuery {
label = "invalid contiguous `Query` data",
note = "if `{Self}` is a custom query type, using `QueryData` derive macro, ensure that the `#[query_data(contiguous(target))]` attribute is added"
)]
pub trait ContiguousQueryData: ArchetypeQueryData {
pub trait ContiguousQueryData: ArchetypeQueryData + IterQueryData {
/// Item returned by [`ContiguousQueryData::fetch_contiguous`].
/// Represents a contiguous chunk of memory.
type Contiguous<'w, 's>;
Expand Down Expand Up @@ -434,6 +434,9 @@ pub trait ContiguousQueryData: ArchetypeQueryData {
/// This is how methods like [`Iterator::collect`] work.
/// It is therefore unsound to offer an [`Iterator`] for a [`QueryData`] for which only one instance may be alive concurrently.
///
/// To iterate over a [`QueryData`] that does not implement [`IterQueryData`],
Comment thread
chescock marked this conversation as resolved.
/// use the [`QueryIter::fetch_next()`](crate::query::QueryIter::fetch_next) method.
///
/// For `QueryData` that implement this trait, [`QueryData::fetch`] may be called for one entity while an item is still alive for a different entity.
///
/// All [`SingleEntityQueryData`] types are [`IterQueryData`].
Expand Down
Loading