diff options
Diffstat (limited to 'ecs/src/component.rs')
-rw-r--r-- | ecs/src/component.rs | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/ecs/src/component.rs b/ecs/src/component.rs index 512c60d..be5756f 100644 --- a/ecs/src/component.rs +++ b/ecs/src/component.rs @@ -121,6 +121,7 @@ pub struct Id impl Id { + #[must_use] pub fn of<ComponentT>() -> Self where ComponentT: Component, @@ -168,6 +169,7 @@ impl From<bool> for IsOptional /// Returns whether the given component type is a optional component. /// /// Will return `true` if the component is a [`Option`]. +#[must_use] pub fn is_optional<ComponentT: Component>() -> bool { if Id::of::<ComponentT>() == Id::of::<Option<ComponentT::Component>>() { @@ -177,7 +179,7 @@ pub fn is_optional<ComponentT: Component>() -> bool false } -pub trait FromOptionalComponent<'comp> +pub trait FromOptional<'comp> { fn from_optional_component( optional_component: Option<WriteGuard<'comp, Box<dyn Component>>>, @@ -189,7 +191,7 @@ macro_rules! inner { seq!(I in 0..=$c { impl<#(Comp~I: Component,)*> Sequence for (#(Comp~I,)*) where - #(for<'comp> Comp~I::RefMut<'comp>: FromOptionalComponent<'comp>,)* + #(for<'comp> Comp~I::RefMut<'comp>: FromOptional<'comp>,)* { type Refs<'component> = (#(Comp~I::RefMut<'component>,)*) where Self: 'component; |