pub struct ClientBuilder { /* private fields */ }
Expand description

A builder for Client.

Implementations

Create a new builder to create a Client.

Build the Client.

Set the default allowed mentions setting to use on all messages sent through the HTTP client.

Set the proxy to use for all HTTP(S) requests.

Note that this isn’t currently a traditional proxy, but is for working with something like twilight’s HTTP proxy server.

Examples

Set the proxy to twilight_http_proxy.internal:

use twilight_http::Client;

let client = Client::builder()
    .proxy("twilight_http_proxy.internal".to_owned(), true)
    .build();

Set a ratelimiter to use.

If the argument is None then the client’s ratelimiter will be skipped before making a request.

If this method is not called at all then a default InMemoryRatelimiter will be created by ClientBuilder::build.

Set the timeout for HTTP requests.

The default is 10 seconds.

Set a group headers which are sent in every request.

Whether to remember whether the client has encountered an Unauthorized response status.

If the client remembers encountering an Unauthorized response, then it will not process future requests.

Defaults to true.

Set the token to use for HTTP requests.

Trait Implementations

Formats the value using the given formatter. Read more

Returns the “default value” for a type. Read more

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

Immutably borrows from an owned value. Read more

Mutably borrows from an owned value. Read more

Performs the conversion.

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more

Instruments this type with the current Span, returning an Instrumented wrapper. Read more

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more