pub struct Response<T> { /* private fields */ }Expand description
A Response from a submitted request.
Implementations§
Source§impl<T> Response<T>
impl<T> Response<T>
Sourcepub fn bytes(self) -> BytesFuture ⓘ
pub fn bytes(self) -> BytesFuture ⓘ
Consumes the response and accumulate the body into bytes.
§Example
use bytes::Bytes;
use modio::types::id::Id;
use modio::Client;
let client = Client::builder(std::env::var("MODIO_API_KEY")?).build()?;
let response = client.get_game(Id::new(51)).await?;
let bytes: Bytes = response.bytes().await?;Sourcepub fn text(self) -> TextFuture ⓘ
pub fn text(self) -> TextFuture ⓘ
Consumes the response and accumulate the body into a string.
§Example
use modio::types::id::Id;
use modio::Client;
let client = Client::builder(std::env::var("MODIO_API_KEY")?).build()?;
let response = client.get_game(Id::new(51)).await?;
let text: String = response.text().await?;Source§impl<T: DeserializeOwned> Response<T>
impl<T: DeserializeOwned> Response<T>
Sourcepub fn data(self) -> DataFuture<T> ⓘ
pub fn data(self) -> DataFuture<T> ⓘ
Consume the response and deserialize the body into the request’s matching model.
§Example
use modio::types::games::Game;
use modio::types::id::Id;
use modio::Client;
let client = Client::builder(std::env::var("MODIO_API_KEY")?).build()?;
let response = client.get_game(Id::new(51)).await?;
let game: Game = response.data().await?;Auto Trait Implementations§
impl<T> !Freeze for Response<T>
impl<T> !RefUnwindSafe for Response<T>
impl<T> Send for Response<T>where
T: Send,
impl<T> Sync for Response<T>where
T: Sync,
impl<T> Unpin for Response<T>where
T: Unpin,
impl<T> !UnwindSafe for Response<T>
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
§impl<T> PolicyExt for Twhere
T: ?Sized,
impl<T> PolicyExt for Twhere
T: ?Sized,
§impl<T> ServiceExt for T
impl<T> ServiceExt for T
§fn compression(self) -> Compression<Self>where
Self: Sized,
fn compression(self) -> Compression<Self>where
Self: Sized,
Compresses response bodies. Read more
§fn decompression(self) -> Decompression<Self>where
Self: Sized,
fn decompression(self) -> Decompression<Self>where
Self: Sized,
Decompress response bodies. Read more
§fn trace_for_http(self) -> Trace<Self, SharedClassifier<ServerErrorsAsFailures>>where
Self: Sized,
fn trace_for_http(self) -> Trace<Self, SharedClassifier<ServerErrorsAsFailures>>where
Self: Sized,
High level tracing that classifies responses using HTTP status codes. Read more
§fn trace_for_grpc(self) -> Trace<Self, SharedClassifier<GrpcErrorsAsFailures>>where
Self: Sized,
fn trace_for_grpc(self) -> Trace<Self, SharedClassifier<GrpcErrorsAsFailures>>where
Self: Sized,
High level tracing that classifies responses using gRPC headers. Read more