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
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
//! A heterogeneous list of registered [`Component`]s.
//!
//! [`Registry`]s are most often defined using the [`Registry!`] macro. The items contained within
//! this module should rarely be needed in user code.
//!
//! Recommended practice is to define a `Registry` as a custom type, and use that type when
//! defining a [`World`].
//!
//! # Example
//! ``` rust
//! use brood::{
//! Registry,
//! World,
//! };
//!
//! // Define components.
//! struct Foo(usize);
//! struct Bar(bool);
//!
//! type Registry = Registry!(Foo, Bar);
//!
//! let world = World::<Registry>::new();
//! ```
//!
//! [`Component`]: crate::component::Component
//! [`Registry`]: crate::registry::Registry
//! [`Registry!`]: crate::Registry!
//! [`World`]: crate::world::World
pub
pub use ;
pub use Clone;
pub use ContainsParQuery;
pub use ;
pub use Debug;
pub use ;
pub use ;
pub use CanonicalParViews;
pub use ;
use crate::;
use Sealed;
define_null_uninstantiable!;
/// A heterogeneous list of [`Component`]s.
///
/// Registries are used when defining [`World`]s. In order for components to be stored within a
/// `World`, they must be included in the `World`'s registry. However, care should be made to only
/// include `Component`s that will be used, as unused `Component`s will cause unnecessary heap
/// allocations.
///
/// While duplicate `Component`s can be included within a registry, it is not advised. There are no
/// benefits to including multiple `Component`s, and the unused components cause higher memory
/// allocation within a `World`.
///
/// # Example
/// ``` rust
/// use brood::Registry;
///
/// // Define components.
/// struct Foo(usize);
/// struct Bar(bool);
///
/// type Registry = Registry!(Foo, Bar);
/// ```
///
/// [`Component`]: crate::component::Component
/// [`World`]: crate::World
/// Creates a registry from the provided components.
///
/// This macro allows a registry to be defined without needing to manually create a heterogeneous
/// list of components. Given an arbitrary number of components, this macro will arrange them into
/// nested tuples forming a heterogeneous list.
///
/// A registry is not normally instantiated. Its main purpose is to be used as a generic in the
/// definition of a [`World`].
///
/// # Example
/// ``` rust
/// use brood::{
/// Registry,
/// World,
/// };
///
/// // Define components `Foo` and `Bar`.
/// struct Foo(u16);
/// struct Bar(f32);
///
/// // Define a registry containing those components.
/// type Registry = Registry!(Foo, Bar);
///
/// // Define a world using the registry.
/// let world = World::<Registry>::new();
/// ```
///
/// [`World`]: crate::World