Created
June 6, 2018 17:09
-
-
Save th0rex/b283a4db82a2fd72e00c684da7254d40 to your computer and use it in GitHub Desktop.
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
#[async(boxed, send)] | |
fn program_main(state: State) -> Result<(), Never> { | |
// Hack to make sure sessions is only created on the polling thread. | |
await!(futures::future::ok::<(), Never>(()))?; | |
let mut sessions: Vec<Session> = vec![]; | |
#[async] | |
for cmd in state.command_rx { | |
use UICommand::*; | |
match cmd { | |
Load(x) => { | |
trace!("load {}", x); | |
let mut file = File::open(&x).expect("could not open file"); | |
let cm: ClientMessage = | |
bincode::deserialize_from(&mut file).expect("corrupted file"); | |
match cm { | |
ClientMessage::Snapshot { regions } => { | |
let idx = sessions.len(); | |
sessions.push(Session::new(ams::graph_from_snapshot(regions))); | |
// TODO: Spawn function on UI thread here. | |
} | |
_ => unreachable!(), | |
} | |
} | |
CalcPointers(x) => { | |
trace!("calc pointers {}", x); | |
} | |
FindPointerTo(x, y) => trace!("find pointers to {} {}", x, y), | |
} | |
} | |
Ok(()) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment