diff options
author | Jesse Luehrs <doy@tozt.net> | 2014-09-04 19:05:30 -0400 |
---|---|---|
committer | Jesse Luehrs <doy@tozt.net> | 2014-09-04 19:05:30 -0400 |
commit | 703b7fa892e6cf48a178a401ca37695b9aeff820 (patch) | |
tree | 55e9d5928cb1db6c38bea1d5096e399f254a85c6 /examples/client.rs | |
parent | 45b85da13a9df80f0f52799b3bc682b5a46f2bc0 (diff) | |
download | rust-irc-closures.tar.gz rust-irc-closures.zip |
callbacks wip (non-working)closures
<doy> wouldn't that mean i couldn't use closures then?
<eddyb> yupp
<doy> ):
<eddyb> they just can't do what you want really well yet
need to wait for the "closures that are quantified over lifetimes" thing
mentioned here
https://github.com/rust-lang/rfcs/blob/master/active/0044-closures.md to
be implemented
Diffstat (limited to 'examples/client.rs')
-rw-r--r-- | examples/client.rs | 11 |
1 files changed, 5 insertions, 6 deletions
diff --git a/examples/client.rs b/examples/client.rs index 98900ef..ac2c420 100644 --- a/examples/client.rs +++ b/examples/client.rs @@ -1,10 +1,9 @@ extern crate irc; fn main () { - let mut client = irc::ClientBuilder::new("doytest", "chat.freenode.net").connect(); - - loop { - let res = client.read(); - println!("{}", res); - } + let mut client = irc::ClientBuilder::new("doytest", "chat.freenode.net") + .add_callback(irc::Client::AnyMessageEvent, |client, m| { + println!("{}", m) + }) + .connect(); } |