Changed examples to be formatted more readibly.

This commit is contained in:
Aaron Weiss 2017-06-21 21:54:48 -04:00
parent 514a08d838
commit d57bb11994
No known key found for this signature in database
GPG key ID: 0237035D9BF03AE2
2 changed files with 20 additions and 28 deletions

View file

@ -13,20 +13,16 @@ fn main() {
}; };
let server = IrcServer::from_config(config).unwrap(); let server = IrcServer::from_config(config).unwrap();
server.identify().unwrap(); server.identify().unwrap();
server server.stream().for_each(|message| {
.stream() print!("{}", message);
.for_each(|message| { match message.command {
print!("{}", message); Command::PRIVMSG(ref target, ref msg) => {
match message.command { if msg.contains("pickles") {
Command::PRIVMSG(ref target, ref msg) => { server.send_privmsg(target, "Hi!").unwrap();
if msg.contains("pickles") {
server.send_privmsg(target, "Hi!").unwrap();
}
} }
_ => (),
} }
Ok(()) _ => (),
}) }
.wait() Ok(())
.unwrap() }).wait().unwrap()
} }

View file

@ -14,20 +14,16 @@ fn main() {
}; };
let server = IrcServer::from_config(config).unwrap(); let server = IrcServer::from_config(config).unwrap();
server.identify().unwrap(); server.identify().unwrap();
server server.stream().for_each(|message| {
.stream() print!("{}", message);
.for_each(|message| { match message.command {
print!("{}", message); Command::PRIVMSG(ref target, ref msg) => {
match message.command { if msg.contains("pickles") {
Command::PRIVMSG(ref target, ref msg) => { server.send_privmsg(target, "Hi!").unwrap();
if msg.contains("pickles") {
server.send_privmsg(target, "Hi!").unwrap();
}
} }
_ => (),
} }
Ok(()) _ => (),
}) }
.wait() Ok(())
.unwrap() }).wait().unwrap()
} }