[][src]Trait yukikaze::client::config::Config

pub trait Config {
    type Connector: Service<Uri> + Default + Clone + Send + Sync;
    type Timer: Oneshot;
    fn decompress() -> bool { ... }
fn timeout() -> Duration { ... }
fn default_user_agent(request: &mut Request) { ... }
fn default_headers(request: &mut Request) { ... }
fn max_redirect_num() -> usize { ... }
fn config_hyper(builder: &mut Builder) -> &mut Builder { ... } }

Generic config trait.

Each method describes single aspect of configuration and provided with sane defaults

Associated Types

type Connector: Service<Uri> + Default + Clone + Send + Sync

Connector type.

type Timer: Oneshot

Timer type.

Loading content...

Provided methods

fn decompress() -> bool

Specifies whether to automatically request compressed response.

Defaults to true.

fn timeout() -> Duration

Specifies request timeout.

Default is 30 seconds

Zero duration means infinite

fn default_user_agent(request: &mut Request)

Specifies how to set user agent

By default it set's Yukikaze/<lib version>, if agent is not present

fn default_headers(request: &mut Request)

Allows to sets default headers before request is sent out

It is called as soon as request is being sent out, but before Accept-Encoding is set.

By default it sets following, if not present:

  • Set default user agent;
  • HOST header with host, and optionally port, taken from URI;

fn max_redirect_num() -> usize

Returns max number of redirects

By default it is 8.

fn config_hyper(builder: &mut Builder) -> &mut Builder

Allows to hook hyper's Client configuration.

By default it uses hyper's defaults

Loading content...

Implementors

impl Config for DefaultCfg[src]

Loading content...