aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTill Hoeppner2015-06-28 21:08:49 +0200
committerTill Hoeppner2015-06-28 21:08:59 +0200
commit41e96ec6d9e78d6523a17e170038167a0fbd3951 (patch)
treede43e9439a46f8d4c788264c3f5ef656eba42cb7
parent9b82e7bb0c944199d03b06846d2cd7075cf19158 (diff)
downloadirsc-41e96ec6d9e78d6523a17e170038167a0fbd3951.tar.gz
irsc-41e96ec6d9e78d6523a17e170038167a0fbd3951.tar.xz
irsc-41e96ec6d9e78d6523a17e170038167a0fbd3951.zip
Add env_logger doc link
-rw-r--r--examples/02.rs6
-rw-r--r--src/command.rs12
2 files changed, 16 insertions, 2 deletions
diff --git a/examples/02.rs b/examples/02.rs
index a562249..c70f905 100644
--- a/examples/02.rs
+++ b/examples/02.rs
@@ -15,6 +15,7 @@ use openssl::ssl::{ Ssl, SslContext, SslMethod };
fn main() {
// If the environment variable RUST_LOG is set to "info",
// irsc will log incoming and outgoing data in raw form.
+ // Documentation: http://rust-lang.github.io/log/env_logger/#enabling-logging
env_logger::init().ok().expect("Failed to initialise env_logger");
let mut s = OwnedClient::new();
@@ -25,8 +26,9 @@ fn main() {
// Connect using the newly constructed Ssl configuration.
// If Ssl is not desired, use .connect(...) without the ssl argument.
s.connect_ssl("irc.mozilla.org", 6697, ssl);
- // Send the USER and NICK message in one go,
- // <nick> <user> <description> <optional password>
+
+ // Send the USER and NICK message in one go:
+ // register(nick, user, description, [password])
s.register("irsc02", "irsc", "Example bot 02", None);
// The client must be accessible from anywh when using the Event API.
diff --git a/src/command.rs b/src/command.rs
index 9ed95d7..1043a43 100644
--- a/src/command.rs
+++ b/src/command.rs
@@ -8,6 +8,18 @@ use message::{ Message, MsgType };
pub type CS<'a> = Cow<'a, str>;
+// If you hoped it couldn't get any uglier... I'm sorry, it does.
+// Why a giant match? API.
+//
+// I tried structuring it as a bunch of structs that impl a `Command` trait,
+// but the user would have to use Any and lots of cats. Also, extensibility isn't
+// really a goal; the IRC protocol doesn't seem to evolve very fast.
+//
+// Granted, I *could* have used a phf-map to map to functions to parse this, which
+// - while more readable - shouldn't have resulted in performance gains.
+//
+// Please don't cry.
+
#[derive(Debug, Hash, Clone, PartialEq, Eq)]
pub enum Command<'a> {
/// ```text