Struct wasi_experimental_http::Response[][src]

pub struct Response {
    pub status_code: StatusCode,
    // some fields omitted
}

An HTTP response

Fields

status_code: StatusCode

Implementations

impl Response[src]

pub fn body_read(&mut self, buf: &mut [u8]) -> Result<usize, Error>[src]

Read a response body in a streaming fashion. buf is an arbitrary large buffer, that may be partially filled after each call. The function returns the actual number of bytes that were written, and 0 when the end of the stream has been reached.

pub fn body_read_all(&mut self) -> Result<Vec<u8>, Error>[src]

Read the entire body until the end of the stream.

pub fn header_get(&self, name: String) -> Result<String, Error>[src]

Get the value of the name header. Returns HttpError::HeaderNotFound if no such header was found.

pub fn headers_get_all(&self) -> Result<HeaderMap, Error>[src]

Get the entire response header map for a given request.

Trait Implementations

impl Drop for Response[src]

Automatically call close to remove the current handle when the response object goes out of scope.

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> Instrument for T[src]

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

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.