pub struct Client { /* private fields */ }
Expand description
An IRC client
Implementations§
Source§impl Client
impl Client
Sourcepub async fn read(&mut self) -> Result<Option<Command>, Error>
pub async fn read(&mut self) -> Result<Option<Command>, Error>
Read data coming from the IRC as a commands::Command
.
§Example
# use async_circe::*;
# let config = Default::default();
# let mut client = Client::new(config).await?;
# client.identify().await?;
loop {
if let Some(ref command) = client.read().await? {
if let commands::Command::PRIVMSG(nick, channel, message) = command {
println!("{} in {}: {}", nick, channel, message);
}
}
# break;
}
# Ok(())
§Errors
Returns IO errors from the TcpStream.
Sourcepub async fn list(
&mut self,
channel: Option<&str>,
server: Option<&str>,
) -> Result<(), Error>
pub async fn list( &mut self, channel: Option<&str>, server: Option<&str>, ) -> Result<(), Error>
Sourcepub async fn topic(
&mut self,
channel: &str,
topic: Option<&str>,
) -> Result<(), Error>
pub async fn topic( &mut self, channel: &str, topic: Option<&str>, ) -> Result<(), Error>
Get the topic of a channel.
§Example
# use async_circe::*;
# let config = Default::default();
# let mut client = Client::new(config).await?;
# client.identify().await?;
client.topic("#chaos", None).await?;
# Ok(())
Set the topic of a channel.
§Example
# let config = Default::default();
# let mut client = Client::new(config).await?;
# client.identify().await?;
client.topic("#chaos", Some("CHAOS")).await?;
# Ok(())
§Errors
Returns IO errors from the TcpStream.
Auto Trait Implementations§
impl Freeze for Client
impl RefUnwindSafe for Client
impl Send for Client
impl Sync for Client
impl Unpin for Client
impl UnwindSafe for Client
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more