[][src]Struct studentvue::request::WebHandle

pub struct WebHandle;

Struct which manages and sends web requests asynchronously

Methods

impl WebHandle[src]

pub async fn make_web_request<'_, R, M, S>(
    uri: R,
    method: M,
    params: S,
    headers: &'_ HeaderMap
) -> Result<Response, Error> where
    R: AsRef<str>,
    M: Into<Method>,
    S: Serialize
[src]

Asynchronously sends a HTTP Request requiring manual parameters which returns a Response

Example

use studentvue::request::WebHandle;
use reqwest::{
    header::HeaderMap,
    Method,
};

#[tokio::main]
async fn main() -> Result<(), reqwest::Error> {
    let params: Vec<&str> = Vec::new();
    let req = WebHandle::make_web_request("https://www.google.com", Method::POST, params, &HeaderMap::new())
        .await?;

    println!("{:?}", req.status());
    Ok(())
}

pub async fn send(
    uri: impl AsRef<str>,
    params: impl Serialize
) -> Result<String, Error>
[src]

Asynchronously sends a POST request to the corresponding WebService endpoint or an optional url with specified parameters

Example

use studentvue::request::WebHandle;

#[tokio::main]
async fn main() -> Result<(), reqwest::Error> {
    let res = WebHandle::send("https://afsd.edupoint.com/Service/PXPCommunication.asmx/ProcessWebServiceRequest", &[("key", "value")])
        .await?;

    Ok(())
}

Trait Implementations

impl Clone for WebHandle[src]

impl Copy for WebHandle[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> 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.