[][src]Struct brawl_api::http::request::Request

pub struct Request<'a> {
    pub body: Option<&'a [u8]>,
    pub headers: Option<HeaderMap>,
    pub endpoint: String,
    pub method: Method,
}

A struct representing a request to some endpoint.

Fields

body: Option<&'a [u8]>

The body of the request. (Note that this is rarely, if ever, used in this lib.)

headers: Option<HeaderMap>

The headers of the request.

endpoint: String

The endpoint (e.g. /players/%23sometag).

method: Method

The method (GET/POST/...). Defaults to GET

Methods

impl<'a> Request<'a>[src]

pub fn build(&'a self, client: &Client) -> Result<RequestBuilder>[src]

(For sync usage) Creates a (blocking) RequestBuilder (reqwest crate) instance.

pub fn a_build(&'a self, client: &Client) -> Result<ARequestBuilder>[src]

(For async usage) Creates a (non-blocking) RequestBuilder (reqwest crate) instance.

Trait Implementations

impl<'a> Clone for Request<'a>[src]

impl<'a> Debug for Request<'a>[src]

impl<'a> Default for Request<'a>[src]

fn default() -> Request<'a>[src]

Returns a default Request instance, with initial values.

Examples

use brawl_api::http::request::Request;
use reqwest::Method;

assert_eq!(
    Request::default(),
    Request {
        body: None,
        headers: None,
        endpoint: String::from(""),
        method: Method::GET,
    }
)

impl<'a> Eq for Request<'a>[src]

impl<'a> PartialEq<Request<'a>> for Request<'a>[src]

impl<'a> StructuralEq for Request<'a>[src]

impl<'a> StructuralPartialEq for Request<'a>[src]

Auto Trait Implementations

impl<'a> RefUnwindSafe for Request<'a>

impl<'a> Send for Request<'a>

impl<'a> Sync for Request<'a>

impl<'a> Unpin for Request<'a>

impl<'a> UnwindSafe for Request<'a>

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<Q, K> Equivalent<K> for Q where
    K: Borrow<Q> + ?Sized,
    Q: Eq + ?Sized
[src]

impl<T> FetchFrom<T> for T where
    T: Clone + Send + Sync
[src]

fn fetch_from(&Client, &T) -> Result<T, Error>[src]

(Sync) Returns a copy of the current instance when attempting to fetch from itself. In order to re-fetch, see Refetchable.

Errors

Never errors; is only a Result in order to match the trait signature.

fn a_fetch_from<'life0, 'life1, 'async_trait>(
    &'life0 Client,
    &'life1 T
) -> Pin<Box<dyn Future<Output = Result<T, Error>> + 'async_trait + Send>> where
    'life0: 'async_trait,
    'life1: 'async_trait,
    T: 'async_trait, 
[src]

(Async) Returns a copy of the current instance when attempting to fetch from itself. In order to re-fetch, see Refetchable.

Errors

Never errors; is only a Result in order to match the trait signature.

impl<T, U> FetchInto<U> for T where
    T: Sync + Send,
    U: FetchFrom<T> + Sync + Send
[src]

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

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

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

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.