#![warn(missing_docs)]
#![no_std]
#![cfg_attr(docsrs, feature(doc_cfg))]
#[cfg(feature = "std")]
extern crate std;
#[doc(hidden)]
pub extern crate alloc;
#[doc(hidden)]
pub extern crate spin;
macro_rules! reverse_apply {
($m: ident [] $($reversed:tt)*) => {
$m!{$($reversed),*} };
($m: ident [$first:tt $($rest:tt)*] $($reversed:tt)*) => {
reverse_apply!{$m [$($rest)*] $first $($reversed)*}
};
}
macro_rules! smaller_tuples_too {
($m: ident, $next: tt) => {
$m!{}
$m!{$next}
};
($m: ident, $next: tt, $($rest: tt),*) => {
smaller_tuples_too!{$m, $($rest),*}
reverse_apply!{$m [$next $($rest)*]}
};
}
mod archetype;
mod batch;
mod borrow;
mod bundle;
mod command_buffer;
mod entities;
mod entity_builder;
mod entity_ref;
mod query;
mod query_one;
#[cfg(any(feature = "row-serialize", feature = "column-serialize"))]
pub mod serialize;
mod take;
mod world;
pub use archetype::{Archetype, ArchetypeColumn, ArchetypeColumnMut};
pub use batch::{BatchIncomplete, BatchWriter, ColumnBatch, ColumnBatchBuilder, ColumnBatchType};
pub use bundle::{Bundle, DynamicBundle, DynamicBundleClone, MissingComponent};
pub use command_buffer::CommandBuffer;
pub use entities::{Entity, NoSuchEntity};
pub use entity_builder::{BuiltEntity, BuiltEntityClone, EntityBuilder, EntityBuilderClone};
pub use entity_ref::{ComponentRef, ComponentRefShared, EntityRef, Ref, RefMut};
pub use query::{
Access, Batch, BatchedIter, Or, PreparedQuery, PreparedQueryBorrow, PreparedQueryIter,
PreparedView, Query, QueryBorrow, QueryIter, QueryMut, QueryShared, Satisfies, View, With,
Without,
};
pub use query_one::QueryOne;
pub use take::TakenEntity;
pub use world::{
ArchetypesGeneration, Component, ComponentError, Iter, QueryOneError, SpawnBatchIter,
SpawnColumnBatchIter, World,
};
#[doc(hidden)]
pub use archetype::TypeInfo;
#[doc(hidden)]
pub use bundle::DynamicClone;
#[doc(hidden)]
pub use query::Fetch;
#[cfg(feature = "macros")]
pub use hecs_macros::{Bundle, DynamicBundleClone, Query};
fn align(x: usize, alignment: usize) -> usize {
debug_assert!(alignment.is_power_of_two());
(x + alignment - 1) & (!alignment + 1)
}