From c7b7084c32f0a78d655e8c82788aa7de1da61315 Mon Sep 17 00:00:00 2001 From: copygirl Date: Sat, 21 Sep 2024 15:48:15 +0200 Subject: [PATCH] Add Component::is_entity and is::relation --- src/ecs/component.rs | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/src/ecs/component.rs b/src/ecs/component.rs index cff7fa4..5308302 100644 --- a/src/ecs/component.rs +++ b/src/ecs/component.rs @@ -37,6 +37,18 @@ impl Component { unsafe { Flags::from_bits_masked(self.high) } } + #[inline] + #[must_use] + pub fn is_entity(&self) -> bool { + self.flags() == Flags::NONE + } + + #[inline] + #[must_use] + pub fn is_relation(&self) -> bool { + self.flags() == Flags::RELATION + } + #[inline] #[must_use] pub fn to_bits(&self) -> u64 {