Skip to content

Instantly share code, notes, and snippets.

@zesterer
Created July 31, 2018 16:48
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 zesterer/ba0d3a737f630d75f3721a6d581542a1 to your computer and use it in GitHub Desktop.
Save zesterer/ba0d3a737f630d75f3721a6d581542a1 to your computer and use it in GitHub Desktop.
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