[][src]Struct scrappy_client::ClientBuilder

pub struct ClientBuilder { /* fields omitted */ }

An HTTP Client builder

This type can be used to construct an instance of Client through a builder-like pattern.

Methods

impl ClientBuilder[src]

pub fn new() -> Self[src]

pub fn connector<T>(self, connector: T) -> Self where
    T: Service<Request = Connect, Error = ConnectError> + 'static,
    T::Response: Connection,
    <T::Response as Connection>::Future: 'static,
    T::Future: 'static, 
[src]

Use custom connector service.

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

Set request timeout

Request timeout is the total time before a response must be received. Default value is 5 seconds.

pub fn disable_timeout(self) -> Self[src]

Disable request timeout.

pub fn disable_redirects(self) -> Self[src]

Do not follow redirects.

Redirects are allowed by default.

pub fn max_redirects(self, num: usize) -> Self[src]

Set max number of redirects.

Max redirects is set to 10 by default.

pub fn no_default_headers(self) -> Self[src]

Do not add default request headers. By default Date and User-Agent headers are set.

pub fn header<K, V>(self, key: K, value: V) -> Self where
    HeaderName: TryFrom<K>,
    <HeaderName as TryFrom<K>>::Error: Debug + Into<HttpError>,
    V: IntoHeaderValue,
    V::Error: Debug
[src]

Add default header. Headers added by this method get added to every request.

pub fn basic_auth<U>(self, username: U, password: Option<&str>) -> Self where
    U: Display
[src]

Set client wide HTTP basic authorization header

pub fn bearer_auth<T>(self, token: T) -> Self where
    T: Display
[src]

Set client wide HTTP bearer authentication header

pub fn finish(self) -> Client[src]

Finish build process and create Client instance.

Trait Implementations

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, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> Same<T> for T

type Output = T

Should always be Self

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.

impl<V, T> VZip<V> for T where
    V: MultiLane<T>,