Trait irc::client::server::Server
[−]
[src]
pub trait Server { fn config(&self) -> &Config; fn send<M: Into<Message>>(&self, message: M) -> Result<()>
where
Self: Sized; fn stream(&self) -> ServerStream; fn list_channels(&self) -> Option<Vec<String>>; fn list_users(&self, channel: &str) -> Option<Vec<User>>; fn for_each_incoming<F>(&self, f: F) -> Result<()>
where
F: FnMut(Message) -> (), { ... } }
An interface for interacting with an IRC server.
Required Methods
fn config(&self) -> &Config
Gets the configuration being used with this Server.
fn send<M: Into<Message>>(&self, message: M) -> Result<()> where
Self: Sized,
Self: Sized,
Sends a Command to this Server.
fn stream(&self) -> ServerStream
Gets a stream of incoming messages from the Server. Note: The stream can only be gotten once. Subsequent attempts will panic.
fn list_channels(&self) -> Option<Vec<String>>
Gets a list of currently joined channels. This will be none if tracking is not supported
altogether (such as when the nochanlists
feature is enabled).
fn list_users(&self, channel: &str) -> Option<Vec<User>>
Gets a list of Users in the specified channel. This will be none if the channel is not
being tracked, or if tracking is not supported altogether. For best results, be sure to
request multi-prefix
support from the server.
Provided Methods
fn for_each_incoming<F>(&self, f: F) -> Result<()> where
F: FnMut(Message) -> (),
F: FnMut(Message) -> (),
Blocks on the stream, running the given function on each incoming message as they arrive.
Implementors
impl Server for IrcServer