diff options
Diffstat (limited to 'ecs/src/component.rs')
-rw-r--r-- | ecs/src/component.rs | 41 |
1 files changed, 10 insertions, 31 deletions
diff --git a/ecs/src/component.rs b/ecs/src/component.rs index b0423c5..f5aa0d1 100644 --- a/ecs/src/component.rs +++ b/ecs/src/component.rs @@ -51,20 +51,19 @@ pub trait Component: SystemInput + Any + TypeName #[doc(hidden)] fn as_any(&self) -> &dyn Any; - /// Whether the component `self` is optional. Returns the same value as - /// [`Component::is_optional`]. - fn self_is_optional(&self) -> IsOptional + /// Returns whether the component `self` is optional. + fn self_is_optional(&self) -> bool { - IsOptional::No + false } /// Returns whether this component is optional. #[must_use] - fn is_optional() -> IsOptional + fn is_optional() -> bool where Self: Sized, { - IsOptional::No + false } } @@ -139,14 +138,14 @@ where self } - fn self_is_optional(&self) -> IsOptional + fn self_is_optional(&self) -> bool { - Self::is_optional() + true } - fn is_optional() -> IsOptional + fn is_optional() -> bool { - IsOptional::Yes + true } } @@ -222,7 +221,7 @@ where pub struct Metadata { pub id: Uid, - pub is_optional: IsOptional, + pub is_optional: bool, } impl Metadata @@ -244,26 +243,6 @@ impl Metadata } } -/// Whether or not a `Component` is optional. -#[derive(Debug, Clone, Copy, PartialEq, Eq)] -pub enum IsOptional -{ - Yes, - No, -} - -impl From<bool> for IsOptional -{ - fn from(is_optional: bool) -> Self - { - if is_optional { - return IsOptional::Yes; - } - - IsOptional::No - } -} - pub trait FromOptionalMut<'comp> { fn from_optional_mut_component( |