[][src]Struct elasticsearch::http::response::Response

pub struct Response(_, _);

A response from Elasticsearch

Implementations

impl Response[src]

pub fn new(response: Response, method: Method) -> Self[src]

Creates a new instance of an Elasticsearch response

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

Get the response content-length, if known.

Reasons it may not be known:

  • The server didn't send a content-length header.
  • The response is compressed and automatically decoded (thus changing the actual decoded length).

pub fn content_type(&self) -> &str[src]

Gets the response content-type.

pub fn error_for_status_code(self) -> Result<Self, ClientError>[src]

Turn the response into an Error if Elasticsearch returned an error.

pub fn error_for_status_code_ref(&self) -> Result<&Self, ClientError>[src]

Turn the response into an Error if Elasticsearch returned an error.

pub async fn exception(self) -> Result<Option<Exception>, ClientError>[src]

Asynchronously reads the response body into an Exception if Elasticsearch returned a HTTP status code in the 400-599 range.

Reading the response body consumes self

pub async fn json<B>(self) -> Result<B, ClientError> where
    B: DeserializeOwned
[src]

Asynchronously reads the response body as JSON

Reading the response body consumes self

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

Gets the response headers.

pub fn method(&self) -> Method[src]

Gets the request method.

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

Get the HTTP status code of the response

pub async fn text(self) -> Result<String, ClientError>[src]

Asynchronously reads the response body as plain text

Reading the response body consumes self

pub fn url(&self) -> &Url[src]

Gets the request URL

pub fn warning_headers(&self) -> impl Iterator<Item = &str>[src]

Gets the Deprecation warning response headers

Deprecation headers signal the use of Elasticsearch functionality or features that are deprecated and will be removed in a future release.

Trait Implementations

impl Debug for Response[src]

Auto Trait Implementations

impl !RefUnwindSafe for Response

impl Send for Response

impl Sync for Response

impl Unpin for Response

impl !UnwindSafe for Response

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, 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.