Last active
January 4, 2016 12:19
-
-
Save jakerr/8620786 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
struct PositionData { | |
x: int, | |
y: int | |
} | |
trait Position { | |
fn position(&self) -> PositionData; | |
} | |
trait Color { | |
fn color(&self) -> int; | |
} | |
trait Renderable : Position + Color {} | |
struct Light { | |
position: PositionData, | |
color: int | |
} | |
impl Position for Light { | |
fn position(&self) -> PositionData { self.position } | |
} | |
impl Color for Light { | |
fn color(&self) -> int { self.color } | |
} | |
impl Renderable for Light {} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
struct PositionData { | |
x: int, | |
y: int | |
} | |
trait Position { | |
position: PositionData; | |
} | |
trait Color { | |
color: int; | |
} | |
trait Renderable : Position + Color {} | |
struct Light { | |
position: PositionData, | |
color: int | |
} | |
impl Renderable for Light {} | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment