From 10c85a9584bb32272394cdb5ad0262dfa4b014f6 Mon Sep 17 00:00:00 2001 From: DanielMowitz Date: Sat, 1 May 2021 15:57:40 +0200 Subject: [PATCH] Some minor fixes. --- src/lib.rs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/lib.rs b/src/lib.rs index 7c3b67a..1f63c48 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -40,13 +40,13 @@ impl IrcRead for IrcStream { let mut message: Option = None; while message == None { let mut temp_buf = [0; 512]; - self.stream.read(&mut temp_buf); + self.stream.read(&mut temp_buf)?; self.buffer.push_str(std::str::from_utf8(&temp_buf)?); match self.buffer.find("\r\n") { Some(i) => { let mut raw_message = self.buffer.clone(); // This returns the part after the line break to the buffer. - self.buffer = raw_message.split_off(i); + self.buffer = raw_message.split_off(i+2); message = Some(Message::from(raw_message.as_str())); }, None => (), @@ -71,7 +71,7 @@ impl IrcWrite for IrcStream { } impl IrcStream { - fn new(stream: S) -> Self { + pub fn new(stream: S) -> Self { Self{ stream, buffer: String::new()