#discord #discord-api #twilight

twilight-http

Discord REST API client for the Twilight ecosystem

12 releases

new 0.2.0-beta.2 Oct 22, 2020
0.2.0-beta.1 Oct 17, 2020
0.1.7 Oct 22, 2020
0.1.5 Sep 27, 2020
0.0.0 Aug 30, 2020

#25 in HTTP client

Download history 10/week @ 2020-08-26 4/week @ 2020-09-02 96/week @ 2020-09-09 100/week @ 2020-09-16 94/week @ 2020-09-23 53/week @ 2020-09-30 66/week @ 2020-10-07 158/week @ 2020-10-14

196 downloads per month
Used in 7 crates (5 directly)

ISC license

1MB
23K 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.1" }

TLS

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

native

The native feature enables reqwest'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.1" }

rustls

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

This is enabled by default.

Dependencies

~6–11MB
~247K SLoC