summaryrefslogtreecommitdiffstats
path: root/examples/client.rs
diff options
context:
space:
mode:
authorJesse Luehrs <doy@tozt.net>2014-09-06 18:39:51 -0400
committerJesse Luehrs <doy@tozt.net>2014-09-06 18:39:51 -0400
commitd64db47867cdd54cdc005333203436fce193c4fc (patch)
tree4522a4dacd5e1a23037c1283589f1e9a98233f62 /examples/client.rs
parent2d401b7685e6f142c5945075ba2d79abfa781f49 (diff)
downloadrust-irc-d64db47867cdd54cdc005333203436fce193c4fc.tar.gz
rust-irc-d64db47867cdd54cdc005333203436fce193c4fc.zip
pass in the client to callbacks
this requires run_loop_with to consume the client, since we need to be able to pass it in mutably. i think that is probably okay.
Diffstat (limited to 'examples/client.rs')
-rw-r--r--examples/client.rs5
1 files changed, 3 insertions, 2 deletions
diff --git a/examples/client.rs b/examples/client.rs
index f1f2479..ef0f7d2 100644
--- a/examples/client.rs
+++ b/examples/client.rs
@@ -1,8 +1,9 @@
extern crate irc;
fn main () {
- let mut client = irc::ClientBuilder::new("doytest", "chat.freenode.net").connect();
- client.run_loop_with(|m| {
+ let builder = irc::ClientBuilder::new("doytest", "chat.freenode.net");
+ let client = builder.connect();
+ client.run_loop_with(|_client, m| {
println!("{}", m);
});
}