1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20
fn accept(ctx, sock) { conn = try!(accept); ctx.add(Http::new(conn)); } impl Http { fn start(ctx) { ctx.add(self.sock, Read) } fn read(self) { match self { Headers => { read_headers() } Body => { read_body() } } } }