diff options
-rw-r--r-- | ecs/src/component.rs | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/ecs/src/component.rs b/ecs/src/component.rs index 14d3b54..a9894b7 100644 --- a/ecs/src/component.rs +++ b/ecs/src/component.rs @@ -194,6 +194,14 @@ impl Metadata is_optional: component.self_is_optional(), } } + + pub fn of<ComponentT: Component>() -> Self + { + Self { + id: ComponentT::id(), + is_optional: ComponentT::is_optional(), + } + } } /// Whether or not a `Component` is optional. |