[][src]Struct idcurl::Response

pub struct Response { /* fields omitted */ }

Represents the result of an HTTP request

This object implements Read, which means you can read it in a streaming fashion or use the accessors to read it into memory.

Methods

impl Response[src]

pub fn status(&self) -> StatusCode[src]

Returns the HTTP status code.

is_success() is the most convenient way to make sure the message was received.

pub fn content_length(&self) -> Option<u64>[src]

Gets the Content-Length of the returned body.

If the server reported the length of the returned body, then this returns it, and None if the server didn't specify. This value is available before the body is read with data() or text_as_utf8()

It may also be a lie.

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

Read the entire document and interpret it as UTF-8.

Read the entire message body into memory.

pub fn copy_to<W: Write + ?Sized>(&mut self, w: &mut W) -> Result<u64>[src]

Copies this Read object into another Write object

Returns the number of bytes read or an Error if the request failed at some point.

pub fn header<K: AsHeaderName>(&self, k: K) -> Option<&HeaderValue>[src]

Gets a specific HTTP header by name

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

Reads all data into a vector, emptying this Response

pub fn headers(&self) -> &HeaderMap[src]

Gets a multimap of all HTTP headers received

pub fn remote_address(&self) -> Result<&str>[src]

The remote ip address for this connection

Trait Implementations

impl Debug for Response[src]

impl Read for Response[src]

Auto Trait Implementations

impl Unpin for Response

impl !Sync for Response

impl !Send for Response

impl UnwindSafe for Response

impl RefUnwindSafe for Response

Blanket Implementations

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

impl<T> From<T> for 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.

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<R> ReadBytesExt for R where
    R: Read + ?Sized