examples/cloning
is a new example showing how to cloneWorld
with some or all components- Added
ColumnBatchType::add_dynamic()
to allow construction of batches for bulk insertion of component data into archetypes. This is useful for inserting data into archetypes where type information for each component is only available at runtime - e.g. the cloning World example.
TypeIdMap
andTypeInfo
are now public to facilitate easy cloning ofWorld
World::query_many_mut
to conveniently query a few entities concurrentlybundle_satisfies_query
anddynamic_bundle_satisfies_query
to easily check whether an entity containing certain components would match a queryWorld::{view, view_mut}
convenience short-hand for constructing a view directly from aWorld
ChangeTracker
helper to detect changes to components usingPartialEq
- Renamed
{View, PreparedView}::get_mut_n
toget_many_mut
for consistency with the proposed std slice method - Order
Entity
values by ID first, then generation
View
andPreparedView
may now be iterated over, just like queriesView::contains
andPreparedView::contains
convenience predicatesno_std
support forhecs-macros
CommandBuffer
now executes operations in the order they are recorded
Ref::map
andRefMut::map
to reborrow a subfield of a component, or cast it to an unsized type
Ref::clone()
is now callable when containing types which do not implementClone
Ref::clone()
could cause a panic as internal state wasn't being updated correctly
- Entity concatenation when inserts recorded in a
CommandBuffer
failed - Incorrect access mode for
Satisfies
queries
DynamicBundle::has
to check whether a bundle contains a componentArchetype::satisfies
to check whether an archetype satisfies a queryserialize::{row,column}::serialize_satisfying
to serialize all entities that satisfy a query
- MSRV raised to 1.65
hecs::QueryItem
replaced with GATQuery::Item
World::{query_one, query_one_mut}
allowed violating a unique borrow.
- Unsound lifetimes in view accessors
- Updated
World::get_unchecked
to match 0.8's changes toWorld::get
CommandBuffer::{insert_one, remove_one}
convenience methods (thanks tesselode!)
- APIs deprecated in 0.7
- Empty archetypes no longer participate in dynamic query borrow-checking
World::satisfies
andEntityRef::satisfies
to check if an entity would match a query
- Many generic methods that previously took a
Component
now instead take either aComponentRef<'a>
or aQuery
to improve consistency with queries and address a common footgun:World::get
,EntityRef::get
, andArchetype::get
now take shared or unique references to component types.- Since
World::get_mut
andEntityRef::get_mut
have been subsumed by their respectiveget
methods, they have been removed. EntityBuilder
andEntityBuilderClone
'sget
andget_mut
were refactored along the same lines for consistency. However, theget_mut
method was not removed for these types since they do not perform dynamic borrow checking.- The
With
/Without
query transformers now take a query that entities must/mustn't match rather than a component type. Additionally, the order of their generic arguments was reversed to place the query whose results will be yielded first.
SerializeContext
traits now take their serializer arguments by value, and must callend()
themselves.
Entity::DANGLING
convenience constant
- Various bad behavior when dangling
Entity
handles are used - Inconsistent component counts in column serialization
World::take
for moving complete entities between worldsCommandBuffer::remove
andCommandBuffer::despawn
- Panics on use of cloned
BuiltEntityClone
s
- Bump hashbrown version
get_unchecked
andget_mut_n
methods onView
andPreparedView
for overlapping borrows
- Minimum supported Rust version is now explicit in Cargo.toml, currently 1.57
- Several internal optimizations thanks to Adam Reichold
derive(DynamicBundleClone)
had an unintended dependency onDynamicClone
being in scopeWorld::len
was incorrect followingWorld::clear
- Missing re-export of
PreparedView
- Insufficiently strict hecs-macros version constraints
World::exchange
provides an optimized path for a remove immediately followed by an insert- Efficient random access can be performed within queries using
QueryBorrow::view
and similar methods, a generalization ofColumn
/ColumnMut
.
World::column
/column_mut
deprecated in favor of views.
EntityBuilderClone::add_bundle
accepting bundles ofClone
components
Or
query combinator, allowing a single query to select entities that satisfy at least one of two sub-queries.EntityRef::has
to efficiently check for the presence of a component without borrowing itEntityBuilderClone
helper for working with dynamic collections of components that may be used repeatedlySatisfies
query combinator, which yields abool
without borrowing any componentsWorld::column
andcolumn_mut
for efficient random access within a single component typeCommandBuffer
helper for recording operations on a world in advance
- Added a niche to
Entity
, makingOption<Entity>
the same size as a bareEntity
. As a consequence,Entity::from_bits
is now fallible, and deserialization ofEntity
values from older versions may fail.
- Compatibility with 32-bit MIPS and PPC
- Missing
Batch
reexport - Missing
ArchetypeColumn
reexport
- Internal memory layout adjusted, reducing
TypeId
-to-pointer look-ups for a minor speedup in per-archetype processing and component insertion/removal.
EntityRef::entity
panicking on empty entities
- An invalid
Entity
could panic rather than returning the appropriate error, especially afterWorld::clear
- Reexported
BatchIncomplete
- Reexported
BatchWriter
- Random-access lookup structures were not correctly populated by column deserialization
World::iter
no longer returns entity IDs directly; they can now instead be fetched from theEntityRef
World::spawn_batch
andWorld::reserve
now employVec
-style amortized resizing, improving performance when called repeatedly.
EntityRef::query
as an alternative toWorld::query_one
when you already have anEntityRef
EntityRef::entity
accessor for recovering the entity's handlePreparedQuery
for improved performance when repeatedly issuing the same query
World::query_mut
did not prevent aliasing mutable borrows within the query
- Documentation updates only
- Improved performance for spawning, inserting, or removing statically-typed component bundles
World::archetypes_generation
not updated when a column batch spawn introduces a new archetype
- Row-major serialization moved under
serialize::row
and behind therow-serialize
cargo feature
EntityRef::len
to query how many components an entity has- Support for serializers that require maps to be of known length
- An alternative column-major serialization layout for better performance and compressibility, in
the
serialize::column
module behind thecolumn-serialize
feature
- Incorrect behavior when building a
ColumnBatch
of zero entities
- The
serde
feature, enabling serialization ofEntity
handles, and aserialization
module to simplify (de)serializing worlds World::len()
exposing the number of live entities- Access to component data inside
Archetypes
to allow custom column-major operations ColumnBatch
for efficiently spawning collections of entities with the same components when those components' types are not statically known
- Incorrect alignment handling in
EntityBuilder
This release includes API extensions and many optimizations, particularly to query
iteration. Special thanks are due to contributors mjhostet for performance improvements, sdleffler
and AngelOfSol for API improvements and internal refactoring, Veykril for rewriting
#[derive(Bundle)]
, and cart for coordinating with the bevy community. This release wouldn't have
been possible without their hard work!
#[derive(Query)]
for more ergonomic specification of complex queries- Support for generic, tuple, and unit structs in
#[derive(Bundle)]
World::query_mut
andWorld::query_one_mut
reduce setup cost when dynamic borrow checks are unnecessaryQueryItem<'a, Q>
type alias identifying the output of the queryQ
borrowing for lifetime'a
World::find_entity_from_id
allows finding a live entity'sEntity
handle from its 32-bitid
.World::spawn_at
allows creating a new entity for an existingEntity
handle, enabling easier deserialization.Archetype::component_types
simplifies certain scripting patterns
- Panic when passing empty bundles to
World::remove
- Misbehavior when using tuple bundles with multiple fields of the same type