Skip to content

Commit

Permalink
Merge pull request #269 from sneakycrow/patch-1
Browse files Browse the repository at this point in the history
Update README examples
  • Loading branch information
aatxe authored Jan 19, 2025
2 parents 9c9e8b2 + a2979df commit e9f0999
Showing 1 changed file with 14 additions and 9 deletions.
23 changes: 14 additions & 9 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -52,20 +52,19 @@ 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> {
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()),
channels: vec!["#test".to_owned()],
..Config::default()
};
let mut client = Client::from_config(config).await?;
client.identify()?;
Expand All @@ -80,19 +79,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
Expand Down

0 comments on commit e9f0999

Please sign in to comment.