summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--ecs-macros/src/lib.rs44
-rw-r--r--ecs/src/component.rs171
-rw-r--r--ecs/src/component/local.rs6
-rw-r--r--ecs/src/relationship.rs40
-rw-r--r--ecs/src/system.rs169
-rw-r--r--ecs/src/system/stateful.rs7
6 files changed, 217 insertions, 220 deletions
diff --git a/ecs-macros/src/lib.rs b/ecs-macros/src/lib.rs
index b58671d..5af10b9 100644
--- a/ecs-macros/src/lib.rs
+++ b/ecs-macros/src/lib.rs
@@ -47,7 +47,7 @@ pub fn component_derive(input: TokenStream) -> TokenStream
{
let item: TypeItem = parse::<Item>(input).unwrap().try_into().unwrap();
- let ComponentAttribute { ref_type, ref_mut_type } = item
+ let ComponentAttribute { handle_type, handle_mut_type } = item
.attribute::<ComponentAttribute>("component")
.unwrap_or_default();
@@ -114,8 +114,10 @@ pub fn component_derive(input: TokenStream) -> TokenStream
Removed as ComponentRemovedEvent,
Kind as ComponentEventKind,
};
- use #ecs_path::system::ComponentRefMut;
- use #ecs_path::system::ComponentRef;
+ use #ecs_path::component::{
+ Handle as ComponentHandle,
+ HandleMut as ComponentHandleMut
+ };
use #ecs_path::uid::{Uid, Kind as UidKind};
use #ecs_path::system::Input as SystemInput;
use #ecs_path::type_name::TypeName;
@@ -129,8 +131,8 @@ pub fn component_derive(input: TokenStream) -> TokenStream
{
type Component = Self;
- type RefMut<'component> = #ref_mut_type;
- type Ref<'component> = #ref_type;
+ type HandleMut<'component> = #handle_mut_type;
+ type Handle<'component> = #handle_type;
fn id() -> Uid
{
@@ -389,32 +391,32 @@ fn find_engine_ecs_crate_path() -> Option<Path>
#[derive(Debug)]
struct ComponentAttribute
{
- ref_type: proc_macro2::TokenStream,
- ref_mut_type: proc_macro2::TokenStream,
+ handle_type: proc_macro2::TokenStream,
+ handle_mut_type: proc_macro2::TokenStream,
}
impl FromAttribute for ComponentAttribute
{
fn from_attribute(attribute: &Attribute) -> Result<Self, syn::Error>
{
- let mut ref_type: Option<Type> = None;
- let mut ref_mut_type: Option<Type> = None;
+ let mut handle_type: Option<Type> = None;
+ let mut handle_mut_type: Option<Type> = None;
attribute.parse_nested_meta(|meta| {
let Some(flag) = meta.path.get_ident() else {
return Err(meta.error("Not a single identifier"));
};
- if flag == "ref_type" {
+ if flag == "handle_type" {
let value = meta.value()?;
- ref_type = Some(value.parse::<Type>()?);
+ handle_type = Some(value.parse::<Type>()?);
return Ok(());
- } else if flag == "ref_mut_type" {
+ } else if flag == "handle_mut_type" {
let value = meta.value()?;
- ref_mut_type = Some(value.parse::<Type>()?);
+ handle_mut_type = Some(value.parse::<Type>()?);
return Ok(());
}
@@ -423,12 +425,12 @@ impl FromAttribute for ComponentAttribute
})?;
Ok(Self {
- ref_type: ref_type
- .map(|ref_type| ref_type.into_token_stream())
- .unwrap_or_else(|| Self::default().ref_type),
- ref_mut_type: ref_mut_type
- .map(|ref_mut_type| ref_mut_type.into_token_stream())
- .unwrap_or_else(|| Self::default().ref_mut_type),
+ handle_type: handle_type
+ .map(|handle_type| handle_type.into_token_stream())
+ .unwrap_or_else(|| Self::default().handle_type),
+ handle_mut_type: handle_mut_type
+ .map(|handle_mut_type| handle_mut_type.into_token_stream())
+ .unwrap_or_else(|| Self::default().handle_mut_type),
})
}
}
@@ -438,8 +440,8 @@ impl Default for ComponentAttribute
fn default() -> Self
{
Self {
- ref_type: quote! { ComponentRef<'component, Self> },
- ref_mut_type: quote! { ComponentRefMut<'component, Self> },
+ handle_type: quote! { ComponentHandle<'component, Self> },
+ handle_mut_type: quote! { ComponentHandleMut<'component, Self> },
}
}
}
diff --git a/ecs/src/component.rs b/ecs/src/component.rs
index 63be828..46fbf8a 100644
--- a/ecs/src/component.rs
+++ b/ecs/src/component.rs
@@ -1,5 +1,6 @@
use std::any::{type_name, Any};
use std::fmt::Debug;
+use std::ops::{Deref, DerefMut};
use seq_macro::seq;
@@ -8,7 +9,14 @@ use crate::event::component::{
Kind as ComponentEventKind,
Removed as ComponentRemovedEvent,
};
-use crate::lock::{Error as LockError, Lock};
+use crate::lock::{
+ Error as LockError,
+ Lock,
+ MappedReadGuard,
+ MappedWriteGuard,
+ ReadGuard,
+ WriteGuard,
+};
use crate::system::Input as SystemInput;
use crate::type_name::TypeName;
use crate::uid::Uid;
@@ -26,11 +34,11 @@ pub trait Component: SystemInput + Any + TypeName
where
Self: Sized;
- type RefMut<'component>: FromLockedOptional<'component>
+ type HandleMut<'component>: FromLockedOptional<'component>
where
Self: Sized;
- type Ref<'component>: FromLockedOptional<'component>
+ type Handle<'component>: FromLockedOptional<'component>
where
Self: Sized;
@@ -101,12 +109,12 @@ impl TypeName for Box<dyn Component>
impl<ComponentT> Component for Option<ComponentT>
where
ComponentT: Component,
- for<'a> Option<ComponentT::Ref<'a>>: FromLockedOptional<'a>,
- for<'a> Option<ComponentT::RefMut<'a>>: FromLockedOptional<'a>,
+ for<'a> Option<ComponentT::Handle<'a>>: FromLockedOptional<'a>,
+ for<'a> Option<ComponentT::HandleMut<'a>>: FromLockedOptional<'a>,
{
type Component = ComponentT;
- type Ref<'component> = Option<ComponentT::Ref<'component>>;
- type RefMut<'component> = Option<ComponentT::RefMut<'component>>;
+ type Handle<'component> = Option<ComponentT::Handle<'component>>;
+ type HandleMut<'component> = Option<ComponentT::HandleMut<'component>>;
fn id() -> Uid
{
@@ -182,7 +190,7 @@ where
ComponentT: Component,
{
type Component = ComponentT;
- type Handle<'component> = ComponentT::Ref<'component>;
+ type Handle<'component> = ComponentT::Handle<'component>;
}
impl<ComponentT> Ref for &mut ComponentT
@@ -190,7 +198,7 @@ where
ComponentT: Component,
{
type Component = ComponentT;
- type Handle<'component> = ComponentT::RefMut<'component>;
+ type Handle<'component> = ComponentT::HandleMut<'component>;
}
/// [`Component`] metadata.
@@ -232,6 +240,151 @@ pub trait FromLockedOptional<'comp>: Sized
) -> Result<Self, LockError>;
}
+#[derive(Debug)]
+pub struct Handle<'a, ComponentT: Component>
+{
+ inner: MappedReadGuard<'a, ComponentT>,
+}
+
+impl<'a, ComponentT: Component> Handle<'a, ComponentT>
+{
+ pub(crate) fn new(inner: ReadGuard<'a, Box<dyn Component>>) -> Self
+ {
+ Self {
+ inner: inner.map(|component| {
+ component.downcast_ref::<ComponentT>().unwrap_or_else(|| {
+ panic!(
+ "Cannot downcast component {} to type {}",
+ component.type_name(),
+ type_name::<ComponentT>()
+ );
+ })
+ }),
+ }
+ }
+}
+
+impl<'component, ComponentT: Component> FromLockedOptional<'component>
+ for Handle<'component, ComponentT>
+{
+ fn from_locked_optional_component(
+ optional_component: Option<&'component crate::lock::Lock<Box<dyn Component>>>,
+ _world: &'component World,
+ ) -> Result<Self, LockError>
+ {
+ let component = optional_component.unwrap_or_else(|| {
+ panic!(
+ "Component {} was not found in entity",
+ type_name::<ComponentT>()
+ );
+ });
+
+ Ok(Self::new(component.read_nonblock()?))
+ }
+}
+
+impl<'comp, ComponentT> FromLockedOptional<'comp> for Option<Handle<'comp, ComponentT>>
+where
+ ComponentT: Component,
+{
+ fn from_locked_optional_component(
+ optional_component: Option<&'comp Lock<Box<dyn Component>>>,
+ _world: &'comp World,
+ ) -> Result<Self, LockError>
+ {
+ optional_component
+ .map(|lock| Ok(Handle::new(lock.read_nonblock()?)))
+ .transpose()
+ }
+}
+
+impl<ComponentT: Component> Deref for Handle<'_, ComponentT>
+{
+ type Target = ComponentT;
+
+ fn deref(&self) -> &Self::Target
+ {
+ &self.inner
+ }
+}
+
+#[derive(Debug)]
+pub struct HandleMut<'a, ComponentT: Component>
+{
+ inner: MappedWriteGuard<'a, ComponentT>,
+}
+
+impl<'a, ComponentT: Component> HandleMut<'a, ComponentT>
+{
+ pub(crate) fn new(inner: WriteGuard<'a, Box<dyn Component>>) -> Self
+ {
+ Self {
+ inner: inner.map(|component| {
+ let component_type_name = component.type_name();
+
+ component.downcast_mut::<ComponentT>().unwrap_or_else(|| {
+ panic!(
+ "Cannot downcast component {component_type_name} to type {}",
+ type_name::<ComponentT>()
+ );
+ })
+ }),
+ }
+ }
+}
+
+impl<'component, ComponentT: Component> FromLockedOptional<'component>
+ for HandleMut<'component, ComponentT>
+{
+ fn from_locked_optional_component(
+ optional_component: Option<&'component Lock<Box<dyn Component>>>,
+ _world: &'component World,
+ ) -> Result<Self, LockError>
+ {
+ let component = optional_component.unwrap_or_else(|| {
+ panic!(
+ "Component {} was not found in entity",
+ type_name::<ComponentT>()
+ );
+ });
+
+ Ok(Self::new(component.write_nonblock()?))
+ }
+}
+
+impl<'comp, ComponentT> FromLockedOptional<'comp> for Option<HandleMut<'comp, ComponentT>>
+where
+ ComponentT: Component,
+{
+ fn from_locked_optional_component(
+ optional_component: Option<&'comp Lock<Box<dyn Component>>>,
+ _world: &'comp World,
+ ) -> Result<Self, LockError>
+ {
+ optional_component
+ .map(|lock| Ok(HandleMut::new(lock.write_nonblock()?)))
+ .transpose()
+ }
+}
+
+impl<ComponentT: Component> Deref for HandleMut<'_, ComponentT>
+{
+ type Target = ComponentT;
+
+ fn deref(&self) -> &Self::Target
+ {
+ &self.inner
+ }
+}
+
+impl<ComponentT: Component> DerefMut for HandleMut<'_, ComponentT>
+{
+ fn deref_mut(&mut self) -> &mut Self::Target
+ {
+ &mut self.inner
+ }
+}
+
macro_rules! inner {
($c: tt) => {
seq!(I in 0..=$c {
diff --git a/ecs/src/component/local.rs b/ecs/src/component/local.rs
index d4e414e..0f6f641 100644
--- a/ecs/src/component/local.rs
+++ b/ecs/src/component/local.rs
@@ -1,14 +1,14 @@
use std::ops::{Deref, DerefMut};
-use crate::component::Component;
-use crate::system::{ComponentRefMut, Param as SystemParam, System};
+use crate::component::{Component, HandleMut as ComponentHandleMut};
+use crate::system::{Param as SystemParam, System};
use crate::World;
/// Holds a component which is local to a single system.
#[derive(Debug)]
pub struct Local<'world, LocalComponent: Component>
{
- local_component: ComponentRefMut<'world, LocalComponent>,
+ local_component: ComponentHandleMut<'world, LocalComponent>,
}
impl<'world, LocalComponent> SystemParam<'world> for Local<'world, LocalComponent>
diff --git a/ecs/src/relationship.rs b/ecs/src/relationship.rs
index 235c21e..45fa265 100644
--- a/ecs/src/relationship.rs
+++ b/ecs/src/relationship.rs
@@ -4,17 +4,21 @@ use std::marker::PhantomData;
use ecs_macros::Component;
use crate::component::storage::Storage as ComponentStorage;
-use crate::component::{Component, FromLockedOptional as FromLockedOptionalComponent};
+use crate::component::{
+ Component,
+ FromLockedOptional as FromLockedOptionalComponent,
+ Handle as ComponentHandle,
+ HandleMut as ComponentHandleMut,
+};
use crate::lock::{Error as LockError, Lock, ReadGuard};
-use crate::system::{ComponentRef, ComponentRefMut};
use crate::uid::{Kind as UidKind, Uid};
use crate::World;
/// A relationship to one or more targets.
#[derive(Debug, Component)]
#[component(
- ref_type = Relation<'component, Kind, ComponentT>,
- ref_mut_type = RelationMut<'component, Kind, ComponentT>,
+ handle_type = Relation<'component, Kind, ComponentT>,
+ handle_mut_type = RelationMut<'component, Kind, ComponentT>,
)]
pub struct Relationship<Kind, ComponentT: Component>
where
@@ -63,7 +67,7 @@ where
ComponentT: Component,
{
component_storage_lock: ReadGuard<'rel_comp, ComponentStorage>,
- relationship_comp: ComponentRefMut<'rel_comp, Relationship<Kind, ComponentT>>,
+ relationship_comp: ComponentHandleMut<'rel_comp, Relationship<Kind, ComponentT>>,
}
impl<'rel_comp, Kind, ComponentT> FromLockedOptionalComponent<'rel_comp>
@@ -76,12 +80,12 @@ where
world: &'rel_comp World,
) -> Result<Self, LockError>
{
- let relationship_comp_ref_from_locked_opt_comp = ComponentRefMut::<
+ let relationship_comp_handle_from_locked_opt_comp = ComponentHandleMut::<
Relationship<Kind, ComponentT>,
>::from_locked_optional_component;
let relationship_comp =
- relationship_comp_ref_from_locked_opt_comp(optional_component, world)?;
+ relationship_comp_handle_from_locked_opt_comp(optional_component, world)?;
let component_storage_lock = world
.data
@@ -124,7 +128,7 @@ where
/// Will panic if the entity does not exist in the archetype it belongs to. This
/// should hopefully never happend.
#[must_use]
- pub fn get(&self, index: usize) -> Option<ComponentRefMut<'_, ComponentT>>
+ pub fn get(&self, index: usize) -> Option<ComponentHandleMut<'_, ComponentT>>
{
let target = self.get_target(index)?;
@@ -136,7 +140,7 @@ where
let component_index = archetype.get_index_for_component(ComponentT::id())?;
- let component = ComponentRefMut::new(
+ let component = ComponentHandleMut::new(
entity
.components()
.get(component_index)?
@@ -235,7 +239,7 @@ where
ComponentT: Component,
{
type IntoIter = TargetComponentIterMut<'relationship, 'rel_comp, Kind, ComponentT>;
- type Item = ComponentRefMut<'rel_comp, ComponentT>;
+ type Item = ComponentHandleMut<'rel_comp, ComponentT>;
fn into_iter(self) -> Self::IntoIter
{
@@ -260,7 +264,7 @@ where
Kind: 'static,
ComponentT: Component,
{
- type Item = ComponentRefMut<'rel_comp, ComponentT>;
+ type Item = ComponentHandleMut<'rel_comp, ComponentT>;
fn next(&mut self) -> Option<Self::Item>
{
@@ -285,7 +289,7 @@ where
ComponentT: Component,
{
component_storage_lock: ReadGuard<'rel_comp, ComponentStorage>,
- relationship_comp: ComponentRef<'rel_comp, Relationship<Kind, ComponentT>>,
+ relationship_comp: ComponentHandle<'rel_comp, Relationship<Kind, ComponentT>>,
}
impl<'rel_comp, Kind, ComponentT> FromLockedOptionalComponent<'rel_comp>
@@ -298,12 +302,12 @@ where
world: &'rel_comp World,
) -> Result<Self, LockError>
{
- let relationship_comp_ref_from_locked_opt_comp = ComponentRef::<
+ let relationship_comp_handle_from_locked_opt_comp = ComponentHandle::<
Relationship<Kind, ComponentT>,
>::from_locked_optional_component;
let relationship_comp =
- relationship_comp_ref_from_locked_opt_comp(optional_component, world)?;
+ relationship_comp_handle_from_locked_opt_comp(optional_component, world)?;
let component_storage_lock = world
.data
@@ -346,7 +350,7 @@ where
/// Will panic if the entity does not exist in the archetype it belongs to. This
/// should hopefully never happend.
#[must_use]
- pub fn get(&self, index: usize) -> Option<ComponentRef<'_, ComponentT>>
+ pub fn get(&self, index: usize) -> Option<ComponentHandle<'_, ComponentT>>
{
let target = self.get_target(index)?;
@@ -358,7 +362,7 @@ where
let component_index = archetype.get_index_for_component(ComponentT::id())?;
- let component = ComponentRef::new(
+ let component = ComponentHandle::new(
entity
.components()
.get(component_index)?
@@ -416,7 +420,7 @@ where
ComponentT: Component,
{
type IntoIter = TargetComponentIter<'relationship, 'rel_comp, Kind, ComponentT>;
- type Item = ComponentRef<'rel_comp, ComponentT>;
+ type Item = ComponentHandle<'rel_comp, ComponentT>;
fn into_iter(self) -> Self::IntoIter
{
@@ -441,7 +445,7 @@ where
Kind: 'static,
ComponentT: Component,
{
- type Item = ComponentRef<'rel_comp, ComponentT>;
+ type Item = ComponentHandle<'rel_comp, ComponentT>;
fn next(&mut self) -> Option<Self::Item>
{
diff --git a/ecs/src/system.rs b/ecs/src/system.rs
index fdf87f8..603c015 100644
--- a/ecs/src/system.rs
+++ b/ecs/src/system.rs
@@ -1,21 +1,11 @@
-use std::any::{type_name, Any};
+use std::any::Any;
use std::convert::Infallible;
use std::fmt::Debug;
-use std::marker::PhantomData;
-use std::ops::{Deref, DerefMut};
use ecs_macros::Component;
use seq_macro::seq;
-use crate::component::{Component, FromLockedOptional as FromLockedOptionalComponent};
-use crate::lock::{
- Error as LockError,
- Lock,
- MappedReadGuard,
- MappedWriteGuard,
- ReadGuard,
- WriteGuard,
-};
+use crate::component::{Component, HandleMut as ComponentHandleMut};
use crate::tuple::{ReduceElement as TupleReduceElement, Tuple};
use crate::World;
@@ -36,7 +26,7 @@ pub trait System<'world, Impl>: 'static
fn get_local_component_mut<LocalComponent: Component>(
&self,
- ) -> Option<ComponentRefMut<LocalComponent>>;
+ ) -> Option<ComponentHandleMut<LocalComponent>>;
fn set_local_component<LocalComponent: Component>(
&mut self,
@@ -95,7 +85,7 @@ macro_rules! impl_system {
fn get_local_component_mut<LocalComponent: Component>(
&self,
- ) -> Option<ComponentRefMut<LocalComponent>>
+ ) -> Option<ComponentHandleMut<LocalComponent>>
{
panic!("System does not have any local components");
}
@@ -189,157 +179,6 @@ impl<Accumulator> TupleReduceElement<Accumulator, ParamWithInputFilter> for ()
type Return = Accumulator;
}
-#[derive(Debug)]
-pub struct ComponentRefMut<'a, ComponentT: Component>
-{
- inner: MappedWriteGuard<'a, ComponentT>,
- _ph: PhantomData<ComponentT>,
-}
-
-impl<'a, ComponentT: Component> ComponentRefMut<'a, ComponentT>
-{
- pub(crate) fn new(inner: WriteGuard<'a, Box<dyn Component>>) -> Self
- {
- Self {
- inner: inner.map(|component| {
- let component_type_name = component.type_name();
-
- component.downcast_mut::<ComponentT>().unwrap_or_else(|| {
- panic!(
- "Cannot downcast component {component_type_name} to type {}",
- type_name::<ComponentT>()
- );
- })
- }),
- _ph: PhantomData,
- }
- }
-}
-
-impl<'component, ComponentT: Component> FromLockedOptionalComponent<'component>
- for ComponentRefMut<'component, ComponentT>
-{
- fn from_locked_optional_component(
- optional_component: Option<&'component crate::lock::Lock<Box<dyn Component>>>,
- _world: &'component World,
- ) -> Result<Self, LockError>
- {
- let component = optional_component.unwrap_or_else(|| {
- panic!(
- "Component {} was not found in entity",
- type_name::<ComponentT>()
- );
- });
-
- Ok(Self::new(component.write_nonblock()?))
- }
-}
-
-impl<'comp, ComponentT> FromLockedOptionalComponent<'comp>
- for Option<ComponentRefMut<'comp, ComponentT>>
-where
- ComponentT: Component,
-{
- fn from_locked_optional_component(
- optional_component: Option<&'comp Lock<Box<dyn Component>>>,
- _world: &'comp World,
- ) -> Result<Self, LockError>
- {
- optional_component
- .map(|lock| Ok(ComponentRefMut::new(lock.write_nonblock()?)))
- .transpose()
- }
-}
-
-impl<ComponentT: Component> Deref for ComponentRefMut<'_, ComponentT>
-{
- type Target = ComponentT;
-
- fn deref(&self) -> &Self::Target
- {
- &self.inner
- }
-}
-
-impl<ComponentT: Component> DerefMut for ComponentRefMut<'_, ComponentT>
-{
- fn deref_mut(&mut self) -> &mut Self::Target
- {
- &mut self.inner
- }
-}
-
-#[derive(Debug)]
-pub struct ComponentRef<'a, ComponentT: Component>
-{
- inner: MappedReadGuard<'a, ComponentT>,
- _ph: PhantomData<ComponentT>,
-}
-
-impl<'a, ComponentT: Component> ComponentRef<'a, ComponentT>
-{
- pub(crate) fn new(inner: ReadGuard<'a, Box<dyn Component>>) -> Self
- {
- Self {
- inner: inner.map(|component| {
- component.downcast_ref::<ComponentT>().unwrap_or_else(|| {
- panic!(
- "Cannot downcast component {} to type {}",
- component.type_name(),
- type_name::<ComponentT>()
- );
- })
- }),
- _ph: PhantomData,
- }
- }
-}
-
-impl<'component, ComponentT: Component> FromLockedOptionalComponent<'component>
- for ComponentRef<'component, ComponentT>
-{
- fn from_locked_optional_component(
- optional_component: Option<&'component crate::lock::Lock<Box<dyn Component>>>,
- _world: &'component World,
- ) -> Result<Self, LockError>
- {
- let component = optional_component.unwrap_or_else(|| {
- panic!(
- "Component {} was not found in entity",
- type_name::<ComponentT>()
- );
- });
-
- Ok(Self::new(component.read_nonblock()?))
- }
-}
-
-impl<'comp, ComponentT> FromLockedOptionalComponent<'comp>
- for Option<ComponentRef<'comp, ComponentT>>
-where
- ComponentT: Component,
-{
- fn from_locked_optional_component(
- optional_component: Option<&'comp Lock<Box<dyn Component>>>,
- _world: &'comp World,
- ) -> Result<Self, LockError>
- {
- optional_component
- .map(|lock| Ok(ComponentRef::new(lock.read_nonblock()?)))
- .transpose()
- }
-}
-
-impl<ComponentT: Component> Deref for ComponentRef<'_, ComponentT>
-{
- type Target = ComponentT;
-
- fn deref(&self) -> &Self::Target
- {
- &self.inner
- }
-}
-
#[derive(Debug, Component)]
pub(crate) struct SystemComponent
{
diff --git a/ecs/src/system/stateful.rs b/ecs/src/system/stateful.rs
index 80ac346..9d911ee 100644
--- a/ecs/src/system/stateful.rs
+++ b/ecs/src/system/stateful.rs
@@ -4,10 +4,9 @@ use std::panic::{RefUnwindSafe, UnwindSafe};
use hashbrown::HashMap;
use seq_macro::seq;
-use crate::component::Component;
+use crate::component::{Component, HandleMut as ComponentHandleMut};
use crate::lock::Lock;
use crate::system::{
- ComponentRefMut,
Into as IntoSystem,
Param,
ParamWithInputFilter,
@@ -110,14 +109,14 @@ macro_rules! impl_system {
fn get_local_component_mut<LocalComponent: Component>(
&self,
- ) -> Option<ComponentRefMut<LocalComponent>>
+ ) -> Option<ComponentHandleMut<LocalComponent>>
{
let local_component = self.local_components
.get(&LocalComponent::id())?
.write_nonblock()
.expect("Failed to aquire read-write local component lock");
- Some(ComponentRefMut::new(local_component))
+ Some(ComponentHandleMut::new(local_component))
}
fn set_local_component<LocalComponent: Component>(