[][src]Struct twilight_http::client::ClientBuilder

pub struct ClientBuilder { /* fields omitted */ }

A builder for Client.

Implementations

impl ClientBuilder[src]

pub fn new() -> Self[src]

Create a new builder to create a Client.

pub fn build(self) -> Result<Client>[src]

Build the Client.

Errors

Errors if reqwest fails to build the client.

pub fn default_allowed_mentions(self, allowed_mentions: AllowedMentions) -> Self[src]

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

pub fn proxy(self, proxy: Proxy) -> Self[src]

Sets the proxy to use for all HTTP requests.

This accepts a reqwest::Proxy.

pub fn proxy_http(self, proxy_http: bool) -> Self[src]

Set whether to proxy over HTTP.

The default is false.

pub fn reqwest_client(self, client: ReqwestClientBuilder) -> Self[src]

Set a pre-configured reqwest client builder to build off of.

The proxy and timeout settings in the reqwest client will be overridden by those in this builder.

The default client uses Rustls as its TLS backend.

pub fn ratelimiter(self, ratelimiter: impl Into<Option<Ratelimiter>>) -> Self[src]

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 ratelimiter will be created by ClientBuilder::build.

pub fn timeout(self, duration: Duration) -> Self[src]

Set the timeout for HTTP requests.

The default is 10 seconds.

pub fn token(self, token: impl Into<String>) -> Self[src]

Set the token to use for HTTP requests.

Trait Implementations

impl Debug for ClientBuilder[src]

impl Default for ClientBuilder[src]

Auto Trait Implementations

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T> Instrument for T[src]

impl<T> Instrument for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.