[][src]Struct sciter::request::Request

pub struct Request(_);

Request object.

Can be constructed from a HREQUEST handle only:

fn on_data_load(pnm: &mut SCN_LOAD_DATA) -> Option<LOAD_RESULT> {
  let mut rq = Request::from(pnm.request_id);
  // ...
}

Implementations

impl Request[src]

pub fn succeeded(&mut self, status: u32, data: Option<&[u8]>) -> Result<()>[src]

Mark the request as complete with status and optional data.

pub fn failed(&mut self, status: u32, data: Option<&[u8]>) -> Result<()>[src]

Mark the request as complete with failure.

pub fn append_received_data(&mut self, data: &[u8]) -> Result<()>[src]

Append a data chunk to the received data.

pub fn get_received_data(&self) -> Result<Vec<u8>>[src]

Get received (so far) data.

pub fn url(&self) -> Result<String>[src]

Get the URL of the request.

pub fn content_url(&self) -> Result<String>[src]

Get a real URL of the content (e.g., after possible redirection).

pub fn method(&self) -> Result<REQUEST_METHOD>[src]

Get the data type of the request.

pub fn request_type(&self) -> Result<RESOURCE_TYPE>[src]

Get the resource data type of the request.

pub fn response_type(&self) -> Result<String>[src]

Get the MIME type of the received data.

pub fn set_response_type(&mut self, mime_type: &str) -> Result<()>[src]

Set the MIME type of the received data.

pub fn set_response_encoding(&mut self, encoding_type: &str) -> Result<()>[src]

Set the data encoding for the received data.

pub fn parameters(&self) -> Result<HashMap<String, String>>[src]

Get the parameters of the request.

pub fn request_headers(&self) -> Result<HashMap<String, String>>[src]

Get the headers of the request.

pub fn set_request_header(&mut self, name: &str, value: &str) -> Result<()>[src]

Set request header (a single item).

pub fn response_headers(&self) -> Result<HashMap<String, String>>[src]

Get the headers of the response.

pub fn set_response_header(&mut self, name: &str, value: &str) -> Result<()>[src]

Set respone header (a single item).

pub fn proxy(&self) -> Result<(String, u16)>[src]

Get proxy host and port (if any).

pub fn completion_status(&self) -> Result<(REQUEST_STATE, u32)>[src]

Get the current completion status of the request.

Returns current state and HTTP response code.

pub fn request_duration(&self) -> Result<Duration>[src]

Get the execution duratiom of the request.

pub fn request_time(&self) -> Result<(Duration, Duration)>[src]

Get the execution started and ended time of the request, in milliseconds.

Trait Implementations

impl Clone for Request[src]

Copies the object.

All allocated objects are reference counted so copying is just a matter of increasing reference counts.

impl Drop for Request[src]

Destroy the object.

impl From<*mut _HREQUEST> for Request[src]

Construct a Request object from HREQUEST handle.

Auto Trait Implementations

impl RefUnwindSafe for Request

impl !Send for Request

impl !Sync for Request

impl Unpin for Request

impl UnwindSafe for Request

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.