#discord #discord-api #twilight

twilight-http

Discord REST API client for the Twilight ecosystem

54 releases (6 breaking)

new 0.6.5 Sep 17, 2021
0.6.3 Aug 30, 2021
0.6.0 Jul 31, 2021
0.3.5 Mar 14, 2021
0.2.5 Nov 29, 2020

#12 in HTTP client

Download history 200/week @ 2021-05-29 224/week @ 2021-06-05 401/week @ 2021-06-12 314/week @ 2021-06-19 269/week @ 2021-06-26 221/week @ 2021-07-03 270/week @ 2021-07-10 358/week @ 2021-07-17 435/week @ 2021-07-24 652/week @ 2021-07-31 342/week @ 2021-08-07 393/week @ 2021-08-14 179/week @ 2021-08-21 298/week @ 2021-08-28 132/week @ 2021-09-04 226/week @ 2021-09-11

1,349 downloads per month
Used in 9 crates (6 directly)

ISC license

2MB
42K SLoC

twilight-http

discord badge github badge license badge rust badge

HTTP support for the twilight ecosystem.

Features

Deserialization

twilight-http supports serde_json and simd-json for deserializing responses.

simd-json

The simd-json feature enables simd-json support to use simd features of modern cpus to deserialize responses faster. It is not enabled by default.

To use this feature you need to also add these lines to <project root>/.cargo/config:

[build]
rustflags = ["-C", "target-cpu=native"]

You can also set the environment variable RUSTFLAGS="-C target-cpu=native". If you enable both serde_json and simd-json at the same time, then simd-json will be used.

To enable simd-json, do something like this in your Cargo.toml:

[dependencies]
twilight-http = { default-features = false, features = ["rustls", "simd-json"], version = "0.2" }

TLS

twilight-http has features to enable hyper's TLS features. These features are mutually exclusive. rustls is enabled by default.

native

The native feature enables hyper's default-tls feature, which is mostly equivalent to using native-tls.

To enable native, do something like this in your Cargo.toml:

[dependencies]
twilight-http = { default-features = false, features = ["native"], version = "0.2" }

rustls

The rustls feature enables hyper's rustls feature, which uses rustls as the TLS backend.

This is enabled by default.

Tracing

The tracing feature enables logging via the tracing crate.

This is disabled by default.

Dependencies

~7–11MB
~226K SLoC