Skip to main content

HttpClient

Struct HttpClient 

Source
pub struct HttpClient<I: Interceptor> { /* private fields */ }

Implementations§

Source§

impl<X: Interceptor> HttpClient<X>

Source

pub async fn get<R, P>(&self, path: P) -> Result<R, Error>
where R: DeserializeOwned + Send + 'static, P: IntoIterator, P::Item: AsRef<str>,

Source

pub async fn get_with_params<R, P, I, K, V>( &self, path: P, params: I, ) -> Result<R, Error>
where R: DeserializeOwned + Send + 'static, P: IntoIterator, P::Item: AsRef<str>, I: IntoIterator, I::Item: Borrow<(K, V)>, K: AsRef<str>, V: AsRef<str>,

Source§

impl HttpClient<NoInterceptor>

Source

pub fn new<U>(base_url: U) -> Result<HttpClient<NoInterceptor>, UrlParseError>
where U: AsRef<str>,

Source§

impl<X: Interceptor> HttpClient<X>

Source

pub fn with_interceptor<O>(self, interceptor: O) -> HttpClient<O>
where O: Interceptor,

Source

pub fn set_default_headers<H, K, V>(&mut self, headers: H)

Source§

impl<X: Interceptor> HttpClient<X>

Source

pub async fn perform_request<R: Send + 'static, P>( &self, request: Request, parse: P, ) -> Result<R, Error>
where P: Fn(Request, Response) -> Result<R, Error> + Send + 'static,

Source§

impl<X: Interceptor> HttpClient<X>

Source

pub fn new_request<P>(&self, path: P) -> Request
where P: IntoIterator, P::Item: AsRef<str>,

Source

pub fn new_request_with_params<P, I, K, V>(&self, path: P, params: I) -> Request
where P: IntoIterator, P::Item: AsRef<str>, I: IntoIterator, I::Item: Borrow<(K, V)>, K: AsRef<str>, V: AsRef<str>,

Source

pub fn new_request_with_url<U>(&self, url: U) -> Result<Request, UrlParseError>
where U: AsRef<str>,

Auto Trait Implementations§

§

impl<I> Freeze for HttpClient<I>
where I: Freeze,

§

impl<I> RefUnwindSafe for HttpClient<I>
where I: RefUnwindSafe,

§

impl<I> Send for HttpClient<I>
where I: Send,

§

impl<I> Sync for HttpClient<I>
where I: Sync,

§

impl<I> Unpin for HttpClient<I>
where I: Unpin,

§

impl<I> UnsafeUnpin for HttpClient<I>
where I: UnsafeUnpin,

§

impl<I> UnwindSafe for HttpClient<I>
where I: UnwindSafe,

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> ErasedDestructor for T
where T: 'static,

Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

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

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.