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
153
154
155
156
157
158
159
160
161
162
163
//! The meta addon enables reflecting on component data.
//!
//! Types are stored as entities with components that store reflection data. This allows
//! for runtime introspection, serialization, and manipulation of component data without
//! compile-time knowledge of the types.
//!
//! # Type Representation
//!
//! A type entity has at least two components:
//! - **`EcsComponent`**: Core component containing size & alignment
//! - **`EcsType`**: Indicates what kind of type the entity represents
//!
//! Additionally, types may have reflection-specific components:
//!
//! ## Structs
//! - `EcsComponent`
//! - `EcsType`
//! - `EcsStruct`
//!
//! Struct members are represented as child entities with the `EcsMember` component.
//! Adding a member child automatically adds `EcsStruct` to the parent.
//!
//! ## Enums/Bitmasks
//! - `EcsComponent`
//! - `EcsType`
//! - `EcsEnum` or `EcsBitmask`
//!
//! Constants are child entities with the `Constant` tag. Values are auto-assigned
//! by default, or can be manually set using `(Constant, i32)` for enums or
//! `(Constant, u32)` for bitmasks.
//!
//! # Usage
//!
//! The easiest way to add reflection data is using the `#[flecs(meta)]` attribute
//! with the `Component` derive macro:
//!
//! ```
//! use flecs_ecs::prelude::*;
//!
//! #[derive(Component)]
//! #[flecs(meta)]
//! struct Position {
//! x: f32,
//! y: f32,
//! }
//!
//! let world = World::new();
//! world.component::<Position>();
//!
//! // The Position type now has full reflection metadata
//! ```
//!
//! Types created with reflection metadata automatically receive `EcsComponent` and
//! `EcsType`, allowing them to be used as regular components:
//!
//! ```
//! # use flecs_ecs::prelude::*;
//! # #[derive(Component)]
//! # #[flecs(meta)]
//! # struct Position { x: f32, y: f32 }
//! # let world = World::new();
//! // Create entity with Position component
//! let entity = world.entity().set(Position { x: 10.0, y: 20.0 });
//! ```
//!
//! # Examples
//!
//! For comprehensive examples of the meta addon, see the [`examples/flecs/reflection/`]
//! directory, which includes:
//! - `reflection_basics.rs` - Basic reflection usage
//! - `reflection_nested_struct.rs` - Nested struct reflection
//! - `member_ranges.rs` - Member validation and ranges
//! - `reflection_runtime_component.rs` - Creating types at runtime
//!
//! [`examples/flecs/reflection/`]: https://github.com/Indra-db/Flecs-Rust/tree/main/flecs_ecs/examples/flecs/flecs/reflection
//!
//! # See also
//!
//! - [`Component` derive macro](crate::macros::Component) with `#[flecs(meta)]` attribute
pub use *;
pub use *;
pub use *;
pub use *;
pub use *;
pub use *;
pub use *;
pub use MetaMember;
pub use *;
use cratesys;
//used for `.member` functions
;