1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
//! Sparsey is an [Entity Component System (ECS)](https://www.geeksforgeeks.org/sparse-set/)
//! based on [sparse sets](https://www.geeksforgeeks.org/sparse-set/).
//!
//! # Example
//!
//! ```rust
//! use sparsey::World;
//!
//! struct Position(i32, i32);
//! struct Velocity(i32, i32);
//!
//! fn main() {
//! let mut world = World::builder()
//! .register::<Position>()
//! .register::<Velocity>()
//! .build();
//!
//! world.create((Position(0, 0), Velocity(1, 2)));
//! world.create((Position(0, 0), Velocity(2, 3)));
//!
//! world.for_each::<(&mut Position, &Velocity)>(|(position, velocity)| {
//! position.0 += velocity.0;
//! position.1 += velocity.1;
//! });
//! }
//! ```
//!
//! # Features
//!
//! - `std` (on by default): link to the `std` crate.
//! - `parallel`: enable parallel iterators.
//!
//! # Usage
//!
//! The most important items from Sparsey crate are [`World`] and [`Entity`],
//! which are re-exported at the root of the crate for easy access. A [`World`]
//! is a collection of entities and components thas supports
//! create/read/update/delete (CRUD) operations, while an [`Entity`] is a
//! versioned index used to reference components within a [`World`].
extern crate alloc;
pub use Entity;
pub use World;