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();
server.identify().unwrap();
server
.stream()
.for_each(|message| {
print!("{}", message);
match message.command {
Command::PRIVMSG(ref target, ref msg) => {
if msg.contains("pickles") {
server.send_privmsg(target, "Hi!").unwrap();
}
server.stream().for_each(|message| {
print!("{}", message);
match message.command {
Command::PRIVMSG(ref target, ref msg) => {
if msg.contains("pickles") {
server.send_privmsg(target, "Hi!").unwrap();
}
_ => (),
}
Ok(())
})
.wait()
.unwrap()
_ => (),
}
Ok(())
}).wait().unwrap()
}

View file

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