1#![warn(missing_docs)]
36#![no_std]
37#![cfg_attr(docsrs, feature(doc_cfg))]
38
39#[cfg(feature = "std")]
40extern crate std;
41
42extern crate alloc;
43
44macro_rules! smaller_tuples_too {
49 ($m: ident, $ty: ident) => {
50 $m!{}
51 $m!{$ty}
52 };
53 ($m: ident, $ty: ident, $($tt: ident),*) => {
54 smaller_tuples_too!{$m, $($tt),*}
55 $m!{$ty, $($tt),*}
56 };
57}
58
59pub mod bundle;
61pub mod query;
63#[cfg(any(feature = "row-serialize", feature = "column-serialize"))]
64pub mod serialize;
65
66mod archetype;
67mod batch;
68mod borrow;
69mod command_buffer;
70mod entities;
71mod entity_builder;
72mod entity_ref;
73mod query_one;
74mod tracked;
75mod take;
76mod world;
77
78pub use archetype::{Archetype, ArchetypeColumn, ArchetypeColumnMut};
79pub use batch::{BatchIncomplete, BatchWriter, ColumnBatch, ColumnBatchBuilder, ColumnBatchType};
80pub use bundle::{Bundle, DynamicBundle, DynamicBundleClone, MissingComponent};
81pub use command_buffer::CommandBuffer;
82pub use entities::{Entity, NoSuchEntity};
83pub use entity_builder::{BuiltEntity, BuiltEntityClone, EntityBuilder, EntityBuilderClone};
84pub use entity_ref::{ComponentRef, ComponentRefShared, EntityRef, Ref, RefMut};
85pub use query::{
86 Access, Batch, BatchedIter, Or, PreparedQuery, PreparedQueryBorrow, PreparedQueryIter,
87 PreparedView, Query, QueryBorrow, QueryIter, QueryMut, QueryShared, Satisfies, View, With,
88 Without,
89};
90pub use query_one::QueryOne;
91pub use tracked::{Added, Changed, Mutated};
92pub use take::TakenEntity;
93pub use world::{
94 ArchetypesGeneration, Component, ComponentError, Iter, QueryOneError, SpawnBatchIter,
95 SpawnColumnBatchIter, World,
96};
97
98#[doc(hidden)]
100pub use archetype::TypeInfo;
101#[doc(hidden)]
102pub use bundle::DynamicClone;
103#[cfg(feature = "macros")]
104#[doc(hidden)]
105pub use lazy_static;
106#[doc(hidden)]
107pub use query::Fetch;
108
109#[cfg(feature = "macros")]
110pub use hecs_macros::{Bundle, DynamicBundleClone, Query};
111
112fn align(x: usize, alignment: usize) -> usize {
113 debug_assert!(alignment.is_power_of_two());
114 (x + alignment - 1) & (!alignment + 1)
115}