{"action":"opened","issue":{"url":"https://api.github.com/repos/rustcc/coroutine-rs/issues/17","labels_url":"https://api.github.com/repos/rustcc/coroutine-rs/issues/17/labels{/name}","comments_url":"https://api.github.com/repos/rustcc/coroutine-rs/issues/17/comments","events_url":"https://api.github.com/repos/rustcc/coroutine-rs/issues/17/events","html_url":"https://github.com/rustcc/coroutine-rs/issues/17","id":60001429,"number":17,"title":"Eventloop design and scheduler","user":{"login":"zonyitoo","id":1067951,"avatar_url":"https://avatars.githubusercontent.com/u/1067951?v=3","gravatar_id":"","url":"https://api.github.com/users/zonyitoo","html_url":"https://github.com/zonyitoo","followers_url":"https://api.github.com/users/zonyitoo/followers","following_url":"https://api.github.com/users/zonyitoo/following{/other_user}","gists_url":"https://api.github.com/users/zonyitoo/gists{/gist_id}","starred_url":"https://api.github.com/users/zonyitoo/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/zonyitoo/subscriptions","organizations_url":"https://api.github.com/users/zonyitoo/orgs","repos_url":"https://api.github.com/users/zonyitoo/repos","events_url":"https://api.github.com/users/zonyitoo/events{/privacy}","received_events_url":"https://api.github.com/users/zonyitoo/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":0,"created_at":"2015-03-05T19:19:42Z","updated_at":"2015-03-05T19:19:42Z","closed_at":null,"body":"Eventloop and scheduler should at least support the following usage\r\n\r\n```rust\r\nspawn(|| {\r\n\r\n    let mut acceptor = TcpStream::connect(\"127.0.0.1:8000\");\r\n\r\n    for client in acceptor.incoming() {\r\n        // Spawns a new coroutine to handle it\r\n        spawn(move|| {\r\n            for line in client.lines() {\r\n                match line {\r\n                    Ok(line) => client.write_all(&line[..].as_bytes()).unwrap();\r\n                    Err(..) => break,\r\n                }\r\n            }\r\n        });\r\n    }\r\n\r\n    println!(\"Server closed\");\r\n\r\n});\r\n```"}}