Skip to content

Commit 2fd4b98

Browse files
Merge branch 'twilight-rs:main' into main
2 parents 0168341 + 86fdbca commit 2fd4b98

File tree

536 files changed

+9423
-7017
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

536 files changed

+9423
-7017
lines changed

.github/ISSUE_TEMPLATE/config.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
contact_links:
2-
- name: Support Server
3-
url: https://discord.gg/7jj8n7D
4-
about: Ask a question here before making an issue, if possible.
2+
- name: Support Server
3+
url: https://discord.gg/twilight-rs
4+
about: Ask a question here before making an issue, if possible.

.github/workflows/check.yml

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -80,6 +80,8 @@ jobs:
8080

8181
- name: Install stable toolchain
8282
uses: dtolnay/rust-toolchain@stable
83+
with:
84+
components: clippy
8385

8486
- name: Cache dependencies
8587
uses: Swatinem/rust-cache@v2
@@ -110,10 +112,9 @@ jobs:
110112
uses: actions/checkout@v4
111113

112114
- name: Install nightly toolchain
113-
uses: dtolnay/rust-toolchain@v1
115+
uses: dtolnay/rust-toolchain@nightly
114116
with:
115117
components: rustfmt
116-
toolchain: nightly
117118

118119
- name: Add problem matchers
119120
run: echo "::add-matcher::.github/rust.json"

Cargo.toml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,8 @@ resolver = "2"
1818

1919
[workspace.package]
2020
authors = ["Twilight Contributors"]
21-
edition = "2021"
21+
edition = "2024"
2222
include = ["src/**/*.rs", "README.md"]
2323
license = "ISC"
2424
repository = "https://github.com/twilight-rs/twilight.git"
25-
rust-version = "1.79"
25+
rust-version = "1.89"

README.md

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ functionality. Please use the individual crates listed below instead!
1616

1717
## Installation
1818

19-
Twilight supports a MSRV of Rust 1.79. We do not consider changes to the MSRV
19+
Twilight supports a MSRV of Rust 1.89. We do not consider changes to the MSRV
2020
semver-incompatible, therefore it may change in minor or patch releases.
2121

2222
We recommend that most users start out with these crates:
@@ -115,7 +115,7 @@ The following example is a template for bootstrapping a new bot using
115115
Twilight's HTTP and gateway clients with its in-memory cache. In order to
116116
run this, replace the contents of a new project's `main.rs` file with the
117117
following. Be sure to set the `DISCORD_TOKEN` environment variable to your
118-
bot's token. You must also depend on `tokio`, `twilight-cache-inmemory`,
118+
bot's token. You must also depend on `rustls`, `tokio`, `twilight-cache-inmemory`,
119119
`twilight-gateway`, `twilight-http`, and `twilight-model` in your `Cargo.toml`.
120120

121121
```rust,no_run
@@ -129,6 +129,9 @@ async fn main() -> anyhow::Result<()> {
129129
// Initialize the tracing subscriber.
130130
tracing_subscriber::fmt::init();
131131
132+
// Select rustls backend
133+
rustls::crypto::ring::default_provider().install_default().unwrap();
134+
132135
let token = env::var("DISCORD_TOKEN")?;
133136
134137
// Use intents to only receive guild message events.

book/src/chapter_1_crates/section_2_http.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,9 @@ async fn main() -> Result<(), Box<dyn Error + Send + Sync>> {
5959
// Initialize the tracing subscriber.
6060
tracing_subscriber::fmt::init();
6161
62+
// Select rustls backend
63+
rustls::crypto::ring::default_provider().install_default().unwrap();
64+
6265
let client = Client::new(env::var("DISCORD_TOKEN")?);
6366
6467
let me = client.current_user().await?.model().await?;

book/src/chapter_1_crates/section_3_gateway.md

Lines changed: 11 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -58,27 +58,17 @@ This is enabled by default.
5858
The `rustls-webpki-roots` feature enables [`tokio-websockets`]'
5959
`rustls-webpki-roots` feature.
6060

61-
### Compression
61+
### Transport compression
6262

6363
`twilight-gateway` supports both Zlib and Zstandard transport compression.
6464

65-
#### Zlib (deprecated)
65+
#### Zlib
6666

67-
Zlib allows specifying two different backends.
67+
The `zlib` feature implementation is `target_arch` dependent:
6868

69-
##### Stock
70-
71-
The `zlib-stock` feature makes [flate2] use of the stock Zlib which is either
72-
upstream or the one included with the operating system.
73-
74-
##### SIMD
75-
76-
`zlib-simd` enables the use of [zlib-ng] which is a modern fork of zlib that in
77-
most cases will be more effective. However, this will add an external dependency
78-
on [cmake].
79-
80-
If both are enabled or if the `zlib` feature of [flate2] is enabled anywhere in
81-
the dependency tree it will make use of that instead of [zlib-ng].
69+
| s390x | other |
70+
| --------------- | ----------- |
71+
| [`zlib-ng-sys`] | [`zlib-rs`] |
8272

8373
#### Zstandard
8474

@@ -99,6 +89,9 @@ async fn main() -> Result<(), Box<dyn Error + Send + Sync>> {
9989
// Initialize the tracing subscriber.
10090
tracing_subscriber::fmt::init();
10191
92+
// Select rustls backend
93+
rustls::crypto::ring::default_provider().install_default().unwrap();
94+
10295
let token = env::var("DISCORD_TOKEN")?;
10396
let intents = Intents::GUILD_MESSAGES;
10497
let mut shard = Shard::new(ShardId::ONE, token, intents);
@@ -128,11 +121,10 @@ async fn main() -> Result<(), Box<dyn Error + Send + Sync>> {
128121

129122
[img:shard]: ./section_3_shard.png
130123
[RusTLS]: https://crates.io/crates/rustls
131-
[cmake]: https://cmake.org/
132-
[flate2]: https://github.com/alexcrichton/flate2-rs
133-
[zlib-ng]: https://github.com/zlib-ng/zlib-ng
134124
[`hyper-rustls`]: https://crates.io/crates/hyper-rustls
135125
[`hyper-tls`]: https://crates.io/crates/hyper-tls
136126
[`serde_json`]: https://crates.io/crates/serde_json
137127
[`simd-json`]: https://crates.io/crates/simd-json
138128
[`tokio-websockets`]: https://crates.io/crates/tokio-websockets
129+
[`zlib-ng-sys`]: https://crates.io/crates/libz-ng-sys
130+
[`zlib-rs`]: https://crates.io/crates/zlib-rs

book/src/chapter_1_crates/section_7_first_party/section_3_lavalink.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,12 @@ use twilight_lavalink::Lavalink;
6161
6262
#[tokio::main]
6363
async fn main() -> Result<(), Box<dyn Error + Send + Sync + 'static>> {
64+
// Initialize the tracing subscriber.
65+
tracing_subscriber::fmt::init();
66+
67+
// Select rustls backend
68+
rustls::crypto::ring::default_provider().install_default().unwrap();
69+
6470
let token = env::var("DISCORD_TOKEN")?;
6571
let lavalink_host = SocketAddr::from_str(&env::var("LAVALINK_HOST")?)?;
6672
let lavalink_auth = env::var("LAVALINK_AUTHORIZATION")?;

book/src/support.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ The API documentation is [also available][api docs].
1515

1616
### Supported Rust Versions
1717

18-
Twilight currently supports an MSRV of Rust 1.53+.
18+
Twilight currently supports an MSRV of Rust 1.89.
1919

2020
### Breaking Changes
2121

examples/Cargo.toml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,16 +9,17 @@ version = "0.0.0"
99
anyhow = { default-features = false, features = ["std"], version = "1" }
1010
ed25519-dalek = "2"
1111
futures-util = { default-features = false, version = "0.3" }
12-
tokio-stream = { default-features = false, version = "0.1" }
1312
hex = "0.4"
1413
http-body-util = "0.1"
1514
hyper = { features = ["server"], version = "1" }
1615
hyper-util = { features = ["http1", "client-legacy"], version = "0.1" }
1716
log = { default-features = false, version = "0.4" }
1817
once_cell = "1.4"
18+
rustls = { default-features = false, features = ["ring"], version = "0.23" }
1919
serde = { version = "1", features = ["derive"] }
2020
serde_json = { version = "1" }
2121
tokio = { default-features = false, features = ["macros", "signal", "rt-multi-thread"], version = "1.0" }
22+
tokio-stream = { default-features = false, version = "0.1" }
2223
tokio-util = "0.7"
2324
tracing = "0.1"
2425
tracing-subscriber = { default-features = false, features = ["fmt", "tracing-log"], version = "0.3" }

examples/cache-optimization/main.rs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,11 @@ mod models;
1212
async fn main() -> anyhow::Result<()> {
1313
tracing_subscriber::fmt::init();
1414

15+
// Select rustls backend
16+
rustls::crypto::ring::default_provider()
17+
.install_default()
18+
.unwrap();
19+
1520
let event_types = EventTypeFlags::MESSAGE_CREATE
1621
| EventTypeFlags::GUILD_CREATE
1722
| EventTypeFlags::GUILD_UPDATE

0 commit comments

Comments
 (0)