config(...) returns a reference instead of a copy of the value.

This commit is contained in:
Aaron Weiss 2014-10-08 13:50:54 -04:00
parent 95a3a8d6b6
commit af1f8ecf14

View file

@ -23,7 +23,7 @@ pub trait Bot<'a> {
fn send_privmsg(&self, chan: &str, msg: &str) -> IoResult<()>; fn send_privmsg(&self, chan: &str, msg: &str) -> IoResult<()>;
fn identify(&self) -> IoResult<()>; fn identify(&self) -> IoResult<()>;
fn output(&mut self) -> IoResult<()>; fn output(&mut self) -> IoResult<()>;
fn config(&self) -> Config; fn config(&self) -> &Config;
} }
pub struct IrcBot<'a, T, U> where T: IrcWriter, U: IrcReader { pub struct IrcBot<'a, T, U> where T: IrcWriter, U: IrcReader {
@ -97,8 +97,8 @@ impl<'a, T, U> Bot<'a> for IrcBot<'a, T, U> where T: IrcWriter, U: IrcReader {
Ok(()) Ok(())
} }
fn config(&self) -> Config { fn config(&self) -> &Config {
self.config.clone() &self.config
} }
} }