-
-
Save jprudent/3ea6958fc3ddd9ff66104ea4c7704cc4 to your computer and use it in GitHub Desktop.
Shared via Rust Playground
This file contains hidden or 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 Hook; | |
struct Timer; | |
struct ComputerUnit<'a> { | |
hooks: Vec<&'a mut Hook>, | |
memory: Mmu<'a> | |
} | |
impl<'a> ComputerUnit<'a> { | |
fn new(hooks: Vec<&'a mut Hook>, timer: &'a Timer) -> ComputerUnit<'a> { | |
ComputerUnit { | |
hooks: hooks, | |
memory: Mmu::new(timer) | |
} | |
} | |
} | |
struct Mmu<'a> { | |
timer : &'a Timer | |
} | |
impl<'a> Mmu<'a> { | |
fn new(timer: &Timer) -> Mmu { | |
Mmu { | |
timer: timer | |
} | |
} | |
} | |
fn tuple() -> (Timer, Timer) { | |
(Timer{}, Timer{}) | |
} | |
fn make(hooks: Vec<& mut Hook>) { | |
let (timer, _) = tuple(); | |
ComputerUnit::new(hooks, &timer); | |
} | |
fn main() { | |
make(vec!()) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment