fn cpu_tick<'a>(req: &mut Request, response: Response<'a>) -> MiddlewareResult<'a> {
	let id = req.param("id").parse::<i32>().ok().expect("unable to tick invalid cpu id");

	match req.extensions().get::<CpuDb>() {
		Some(cpuserv) => {
			let mut w_serv = cpuserv.write().unwrap();
			match w_serv.database.get_mut(&id) {
				Some(cpu) => {
					cpu.last = cpu.state;
					cpu.state.tick(); 
					response.send(format!("{}", cpu.state.js_dump())) 
				},

				None => { response.send("did not find cpu") }
			}
		},

		None => { response.send("did not find cpu serv") }
	}
}
/// POST /cpu/:id/tick
/// Resumes execution from the next instruction; running the machine to completion.
/// The resultant state is then dumped to the console.
POST /cpu/:id/tick
Resumes execution from the next instruction; running the machine to completion.
The resultant state is then dumped to the console.
POST / cpu / : id / tick Resumes execution from the next instruction ; running the machine to completion . The resultant state is then dumped to the console .
fn cpu_tick<'a>(req: &mut Request, response: Response<'a>) -> MiddlewareResult<'a> {
	let id = req.param("id").parse::<i32>().ok().expect("unable to tick invalid cpu id");
	match req.extensions().get::<CpuDb>() {
		Some(cpuserv) => {
			let mut w_serv = cpuserv.write().unwrap();
			match w_serv.database.get_mut(&id) {
				Some(cpu) => {
					cpu.last = cpu.state;
					cpu.state.tick(); 
					response.send(format!("{}", cpu.state.js_dump())) 
				},
				None => { response.send("did not find cpu") }
			}
		},
		None => { response.send("did not find cpu serv") }
	}
}
fn cpu_tick < ' a > ( req : & mut Request , response : Response < ' a > ) -> MiddlewareResult < ' a > { let id = req . param ( " " ) . parse :: < i32 > ( ) . ok ( ) . expect ( " " ) ; match req . extensions ( ) . get :: < CpuDb > ( ) { Some ( cpuserv ) => { let mut w_serv = cpuserv . write ( ) . unwrap ( ) ; match w_serv . database . get_mut ( & id ) { Some ( cpu ) => { cpu . last = cpu . state ; cpu . state . tick ( ) ; response . send ( format ! ( " " cpu state js_dump ( ) ) ) } , None => { response . send ( " " ) } } } , None => { response . send ( " " ) } } }
POST /cpu/:id/tick
Resumes execution from the next instruction; running the machine to completion.
POST / cpu / : id / tick Resumes execution from the next instruction ; running the machine to completion .
req
&mut Request
response
Response<'a>