diff options
author | HampusM <hampus@hampusmat.com> | 2024-11-16 19:12:12 +0100 |
---|---|---|
committer | HampusM <hampus@hampusmat.com> | 2024-11-16 19:12:12 +0100 |
commit | 82328c9ca16849ec432f9125f4b61ebb63f5e17c (patch) | |
tree | 09b1dba7b89f4a7a524e4ce2039ab4ac14268cf1 /ecs | |
parent | 7feb816799cdcc03163045ad2bf005fe191cfc0e (diff) |
feat(ecs): add component::Metadata of function
Diffstat (limited to 'ecs')
-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. |