From 111ed0b4b2e072fc83fee65e72485b5522fbd320 Mon Sep 17 00:00:00 2001 From: Zachary Corvidae Date: Sat, 11 Jan 2025 12:17:49 -0800 Subject: [PATCH 1/2] Update README examples Update editions to 2021 and change out failure for anyhow --- README.md | 24 ++++++++++++++---------- 1 file changed, 14 insertions(+), 10 deletions(-) diff --git a/README.md b/README.md index d13acc24..c0f5f498 100644 --- a/README.md +++ b/README.md @@ -52,20 +52,18 @@ documentation, and below. The release of v0.14 replaced all existing APIs with one based on async/await. -```rust,no_run,edition2018 -use irc::client::prelude::*; +```rust,no_run,edition2021 use futures::prelude::*; +use irc::client::prelude::*; #[tokio::main] -async fn main() -> Result<(), failure::Error> { - // We can also load the Config at runtime via Config::load("path/to/config.toml") +async fn main() -> Result<(), anyhow::Error> { let config = Config { nickname: Some("the-irc-crate".to_owned()), server: Some("chat.freenode.net".to_owned()), channels: vec!["#test".to_owned()], ..Config::default() }; - let mut client = Client::from_config(config).await?; client.identify()?; @@ -80,19 +78,25 @@ async fn main() -> Result<(), failure::Error> { ``` Example Cargo.toml file: -```rust,no_run,edition2018 +```rust,no_run,edition2021 [package] name = "example" version = "0.1.0" -edition = "2018" +edition = "2021" # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html [dependencies] +anyhow = "1.0" +futures = "0.3" irc = "1.0.0" -tokio = { version = "1.0.0", features = ["rt", "rt-multi-thread", "macros", "net", "time"] } -futures = "0.3.0" -failure = "0.1.8" +tokio = { version = "1.0", features = [ + "rt", + "rt-multi-thread", + "macros", + "net", + "time", +] } ``` ## Configuring IRC Clients From a2979df520524dbe7c10e3fd1a42d8c4131ae4e6 Mon Sep 17 00:00:00 2001 From: Zachary Corvidae Date: Sat, 11 Jan 2025 12:19:41 -0800 Subject: [PATCH 2/2] Re-add Config::load comment --- README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/README.md b/README.md index c0f5f498..1a6befed 100644 --- a/README.md +++ b/README.md @@ -58,6 +58,7 @@ use irc::client::prelude::*; #[tokio::main] async fn main() -> Result<(), anyhow::Error> { + // We can also load the Config at runtime via Config::load("path/to/config.toml") let config = Config { nickname: Some("the-irc-crate".to_owned()), server: Some("chat.freenode.net".to_owned()),