examples/cloningis a new example showing how to cloneWorldwith 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.
TypeIdMapandTypeInfoare now public to facilitate easy cloning ofWorld
World::query_many_mutto conveniently query a few entities concurrentlybundle_satisfies_queryanddynamic_bundle_satisfies_queryto easily check whether an entity containing certain components would match a queryWorld::{view, view_mut}convenience short-hand for constructing a view directly from aWorldChangeTrackerhelper to detect changes to components usingPartialEq
- Renamed
{View, PreparedView}::get_mut_ntoget_many_mutfor consistency with the proposed std slice method - Order
Entityvalues by ID first, then generation
ViewandPreparedViewmay now be iterated over, just like queriesView::containsandPreparedView::containsconvenience predicatesno_stdsupport forhecs-macros
CommandBuffernow executes operations in the order they are recorded
Ref::mapandRefMut::mapto reborrow a subfield of a component, or cast it to an unsized type
Ref::clone()is now callable when containing types which do not implementCloneRef::clone()could cause a panic as internal state wasn't being updated correctly
- Entity concatenation when inserts recorded in a
CommandBufferfailed - Incorrect access mode for
Satisfiesqueries
DynamicBundle::hasto check whether a bundle contains a componentArchetype::satisfiesto check whether an archetype satisfies a queryserialize::{row,column}::serialize_satisfyingto serialize all entities that satisfy a query
- MSRV raised to 1.65
hecs::QueryItemreplaced with GATQuery::Item
World::{query_one, query_one_mut}allowed violating a unique borrow.
- Unsound lifetimes in view accessors
- Updated
World::get_uncheckedto 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::satisfiesandEntityRef::satisfiesto check if an entity would match a query
- Many generic methods that previously took a
Componentnow instead take either aComponentRef<'a>or aQueryto improve consistency with queries and address a common footgun:World::get,EntityRef::get, andArchetype::getnow take shared or unique references to component types.- Since
World::get_mutandEntityRef::get_muthave been subsumed by their respectivegetmethods, they have been removed. EntityBuilderandEntityBuilderClone'sgetandget_mutwere refactored along the same lines for consistency. However, theget_mutmethod was not removed for these types since they do not perform dynamic borrow checking.- The
With/Withoutquery 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.
SerializeContexttraits now take their serializer arguments by value, and must callend()themselves.
Entity::DANGLINGconvenience constant
- Various bad behavior when dangling
Entityhandles are used - Inconsistent component counts in column serialization
World::takefor moving complete entities between worldsCommandBuffer::removeandCommandBuffer::despawn
- Panics on use of cloned
BuiltEntityClones
- Bump hashbrown version
get_uncheckedandget_mut_nmethods onViewandPreparedViewfor 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 onDynamicClonebeing in scopeWorld::lenwas incorrect followingWorld::clear- Missing re-export of
PreparedView
- Insufficiently strict hecs-macros version constraints
World::exchangeprovides an optimized path for a remove immediately followed by an insert- Efficient random access can be performed within queries using
QueryBorrow::viewand similar methods, a generalization ofColumn/ColumnMut.
World::column/column_mutdeprecated in favor of views.
EntityBuilderClone::add_bundleaccepting bundles ofClonecomponents
Orquery combinator, allowing a single query to select entities that satisfy at least one of two sub-queries.EntityRef::hasto efficiently check for the presence of a component without borrowing itEntityBuilderClonehelper for working with dynamic collections of components that may be used repeatedlySatisfiesquery combinator, which yields aboolwithout borrowing any componentsWorld::columnandcolumn_mutfor efficient random access within a single component typeCommandBufferhelper 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_bitsis now fallible, and deserialization ofEntityvalues from older versions may fail.
- Compatibility with 32-bit MIPS and PPC
- Missing
Batchreexport - Missing
ArchetypeColumnreexport
- Internal memory layout adjusted, reducing
TypeId-to-pointer look-ups for a minor speedup in per-archetype processing and component insertion/removal.
EntityRef::entitypanicking on empty entities
- An invalid
Entitycould 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::iterno longer returns entity IDs directly; they can now instead be fetched from theEntityRefWorld::spawn_batchandWorld::reservenow employVec-style amortized resizing, improving performance when called repeatedly.
EntityRef::queryas an alternative toWorld::query_onewhen you already have anEntityRefEntityRef::entityaccessor for recovering the entity's handlePreparedQueryfor improved performance when repeatedly issuing the same query
World::query_mutdid not prevent aliasing mutable borrows within the query
- Documentation updates only
- Improved performance for spawning, inserting, or removing statically-typed component bundles
World::archetypes_generationnot updated when a column batch spawn introduces a new archetype
- Row-major serialization moved under
serialize::rowand behind therow-serializecargo feature
EntityRef::lento 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::columnmodule behind thecolumn-serializefeature
- Incorrect behavior when building a
ColumnBatchof zero entities
- The
serdefeature, enabling serialization ofEntityhandles, and aserializationmodule to simplify (de)serializing worlds World::len()exposing the number of live entities- Access to component data inside
Archetypesto allow custom column-major operations ColumnBatchfor 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_mutandWorld::query_one_mutreduce setup cost when dynamic borrow checks are unnecessaryQueryItem<'a, Q>type alias identifying the output of the queryQborrowing for lifetime'aWorld::find_entity_from_idallows finding a live entity'sEntityhandle from its 32-bitid.World::spawn_atallows creating a new entity for an existingEntityhandle, enabling easier deserialization.Archetype::component_typessimplifies certain scripting patterns
- Panic when passing empty bundles to
World::remove - Misbehavior when using tuple bundles with multiple fields of the same type