[−][src]Struct elasticsearch::http::response::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]
B: DeserializeOwned,
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
Auto Trait Implementations
impl !RefUnwindSafe for Response
[src]
impl Send for Response
[src]
impl Sync for Response
[src]
impl Unpin for Response
[src]
impl !UnwindSafe for Response
[src]
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
pub fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> From<T> for T
[src]
impl<T> Instrument for T
[src]
pub fn instrument(self, span: Span) -> Instrumented<Self>
[src]
pub fn in_current_span(self) -> Instrumented<Self>
[src]
impl<T> Instrument for T
[src]
pub fn instrument(self, span: Span) -> Instrumented<Self>
[src]
pub fn in_current_span(self) -> Instrumented<Self>
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
pub fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,