Skip to content

Commit

Permalink
reorder impls
Browse files Browse the repository at this point in the history
  • Loading branch information
lassade authored and cart committed Nov 22, 2020
1 parent 47aa7e1 commit 0ee990a
Showing 1 changed file with 15 additions and 15 deletions.
30 changes: 15 additions & 15 deletions crates/bevy_transform/src/components/parent.rs
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,20 @@ impl MapEntities for Parent {
}
}

impl Deref for Parent {
type Target = Entity;

fn deref(&self) -> &Self::Target {
&self.0
}
}

impl DerefMut for Parent {
fn deref_mut(&mut self) -> &mut Self::Target {
&mut self.0
}
}

#[derive(Debug, Copy, Clone, Eq, PartialEq, Properties)]
pub struct PreviousParent(pub(crate) Entity);

Expand All @@ -38,23 +52,9 @@ impl MapEntities for PreviousParent {
}
}

// TODO: Better handle this case
// TODO: Better handle this case see `impl FromResources for Parent`
impl FromResources for PreviousParent {
fn from_resources(_resources: &bevy_ecs::Resources) -> Self {
PreviousParent(Entity::new(u32::MAX))
}
}

impl Deref for Parent {
type Target = Entity;

fn deref(&self) -> &Self::Target {
&self.0
}
}

impl DerefMut for Parent {
fn deref_mut(&mut self) -> &mut Self::Target {
&mut self.0
}
}

0 comments on commit 0ee990a

Please sign in to comment.