fix incorrect return type. mutable component should be returned
This commit is contained in:
parent
db261d2356
commit
9072879f4f
|
@ -207,7 +207,7 @@ pub trait ComponentStoreConvenience<T: Component> {
|
||||||
}
|
}
|
||||||
|
|
||||||
pub trait ComponentStoreConvenienceMut<T: Component> {
|
pub trait ComponentStoreConvenienceMut<T: Component> {
|
||||||
fn single_mut(&mut self) -> Option<(&EntityId, &T)>;
|
fn single_mut(&mut self) -> Option<(&EntityId, &mut T)>;
|
||||||
fn get_mut(&mut self, k: &EntityId) -> Option<&mut T>;
|
fn get_mut(&mut self, k: &EntityId) -> Option<&mut T>;
|
||||||
fn contains_key(&mut self, k: &EntityId) -> bool;
|
fn contains_key(&mut self, k: &EntityId) -> bool;
|
||||||
}
|
}
|
||||||
|
@ -267,7 +267,7 @@ impl<'a, T: Component> ComponentStoreConvenience<T> for Option<RefMutComponents<
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<'a, T: Component> ComponentStoreConvenienceMut<T> for Option<RefMutComponents<'a, T>> {
|
impl<'a, T: Component> ComponentStoreConvenienceMut<T> for Option<RefMutComponents<'a, T>> {
|
||||||
fn single_mut(&mut self) -> Option<(&EntityId, &T)> {
|
fn single_mut(&mut self) -> Option<(&EntityId, &mut T)> {
|
||||||
if let Some(components) = self {
|
if let Some(components) = self {
|
||||||
if let Some((entity_id, component)) = components.iter_mut().next() {
|
if let Some((entity_id, component)) = components.iter_mut().next() {
|
||||||
return Some((entity_id, component));
|
return Some((entity_id, component));
|
||||||
|
|
Loading…
Reference in a new issue