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
//! # Component Registry
//!
//! This module provides a component registry that assigns stable `ComponentID`
//! values to Rust component types and exposes type-erased storage factories for
//! archetype column allocation.
//!
//! ## Purpose
//! The registry decouples component type information (`TypeId`, name, size, alignment)
//! from runtime storage, enabling archetypes to store heterogeneous component columns
//! behind `TypeErasedAttribute`.
//!
//! ## Design
//! - Components are registered once and assigned a compact `ComponentID` in `[0, COMPONENT_CAP]`.
//! - A per-component factory function is stored for constructing empty column storage.
//! - The registry can be `freeze()`d to prevent further registrations after world setup.
//!
//! ## Instance-owned registry
//!
//! `ComponentRegistry` is a standalone, instance-owned struct that holds the
//! component table, the factory table, and the next-ID counter together. This
//! enables multiple independent ECS worlds in the same process.
//!
//! A global `static REGISTRY` and `static COMPONENT_FACTORIES` is
//! maintained behind convenience functions for simple, single-world use cases.
//! These delegate to a shared global `ComponentRegistry` instance.
//!
//! ## Invariants
//! - `ComponentID` values are unique and stable for the lifetime of the registry.
//! - A registered component must have a corresponding storage factory.
//! - When frozen, registration is disallowed.
//!
//! ## Concurrency
//! The global registry is protected by `RwLock` for concurrent reads and
//! serialized writes. Instance-owned registries are wrapped in
//! `Arc<RwLock<ComponentRegistry>>` by `ECSData`.
// -- Signature & helpers --
pub use or_signature_in_place;
pub use ;
// -- Component descriptor --
pub use ComponentDesc;
// -- Bundle --
pub use ;
// -- Instance-owned registry --
pub use ComponentRegistry;
// -- Global convenience API --
// Available for internal use and single-world convenience; not re-exported
// from the crate root.
pub use ;
pub use ;