Skip to content

Instantly share code, notes, and snippets.

@jprudent
Forked from anonymous/playground.rs
Created January 18, 2017 13:36
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jprudent/3ea6958fc3ddd9ff66104ea4c7704cc4 to your computer and use it in GitHub Desktop.
Save jprudent/3ea6958fc3ddd9ff66104ea4c7704cc4 to your computer and use it in GitHub Desktop.
Shared via Rust Playground
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