irc/
lib.rs

1//! A simple, thread-safe, and async-friendly library for IRC clients.
2//!
3//! # Quick Start
4//! The main public API is entirely exported in [`client::prelude`].
5//! This should include everything necessary to write an IRC client or bot.
6//!
7//! # A Whirlwind Tour
8//! The irc crate is divided into two main modules: [`client`] and
9//! [`proto`]. As the names suggest, the `client` module captures the whole of
10//! the client-side functionality, while the `proto` module features general components of an IRC
11//! protocol implementation that could in principle be used in either client or server software.
12//! Both modules feature a number of components that are low-level and can be used to build
13//! alternative APIs for the IRC protocol. For the average user, the higher-level components for an
14//! IRC client are all re-exported in [`client::prelude`]. That module
15//! serves as the best starting point for a new user trying to understand the high-level API.
16//!
17//! # Example
18//!
19//! ```no_run
20//! use irc::client::prelude::*;
21//! use futures::prelude::*;
22//!
23//! # #[tokio::main]
24//! # async fn main() -> irc::error::Result<()> {
25//! // configuration is loaded from config.toml into a Config
26//! let mut client = Client::new("config.toml").await?;
27//! // identify comes from ClientExt
28//! client.identify()?;
29//!
30//! let mut stream = client.stream()?;
31//!
32//! while let Some(message) = stream.next().await.transpose()? {
33//!     if let Command::PRIVMSG(channel, message) = message.command {
34//!         if message.contains(&*client.current_nickname()) {
35//!             // send_privmsg comes from ClientExt
36//!             client.send_privmsg(&channel, "beep boop").unwrap();
37//!         }
38//!     }
39//! }
40//! # Ok(())
41//! # }
42//! ```
43
44#![warn(missing_docs)]
45
46pub extern crate irc_proto as proto;
47
48pub mod client;
49pub mod error;
50
51const VERSION_STR: &str = concat!(
52    env!("CARGO_PKG_NAME"),
53    ":",
54    env!("CARGO_PKG_VERSION"),
55    ":Compiled with rustc",
56);