Created
July 31, 2018 16:48
-
-
Save zesterer/ba0d3a737f630d75f3721a6d581542a1 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 Client { | |
jobs: Jobs, | |
depot: PostDepot, | |
} | |
impl Client { | |
fn new() -> Client { | |
Client { jobs: Jobs::new(), depot: PostDepot::new() } | |
} | |
fn handle_entity_msgs(&self) { | |
let postbox = c.depot.new_postbox::<EntityMsg>(); | |
while let Ok(msg) = postbox.recv() { | |
/* Handle message here */ | |
}} | |
} | |
fn tick() -> bool { | |
// Stuff here | |
true | |
} | |
fn start(&self) { | |
self.jobs.run_once(|c| c.handle_entity_msgs()); | |
self.jobs.run_while(|c| c.tick()); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment