Crate twilight_http[][src]

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.

Re-exports

pub use crate::client::Client;
pub use crate::error::Error;
pub use crate::error::Result;

Modules

api_error
client
error
ratelimiting
request
routing

Constants

API_VERSION

Discord API version used by this crate.