Skip to main content

HttpRequestExt

Trait HttpRequestExt 

Source
pub trait HttpRequestExt {
    // Required methods
    fn follow_redirects(self, follow: RedirectPolicy) -> Self;
    fn timeout(self, timeout: Duration) -> Self;

    // Provided methods
    fn when(self, condition: bool, then: impl FnOnce(Self) -> Self) -> Self
       where Self: Sized { ... }
    fn when_some<T>(
        self,
        option: Option<T>,
        then: impl FnOnce(Self, T) -> Self,
    ) -> Self
       where Self: Sized { ... }
}

Required Methods§

Source

fn follow_redirects(self, follow: RedirectPolicy) -> Self

Whether or not to follow redirects

Source

fn timeout(self, timeout: Duration) -> Self

Sets a deadline for the complete HTTP request, including its response body.

Provided Methods§

Source

fn when(self, condition: bool, then: impl FnOnce(Self) -> Self) -> Self
where Self: Sized,

Conditionally modify self with the given closure.

Source

fn when_some<T>( self, option: Option<T>, then: impl FnOnce(Self, T) -> Self, ) -> Self
where Self: Sized,

Conditionally unwrap and modify self with the given closure, if the given option is Some.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§