pub struct AsyncResponse<T = ()> { /* private fields */ }Expand description
A typed HTTP response that completes asynchronously outside the Pipeline.
The type parameter T is a marker type that identifies trait to deserialize defined headers;
otherwise, it is the unit type () if no headers are defined.
Given an AsyncResponse<T>, a user can access the raw AsyncResponseBody using AsyncResponse::into_body.
Implementations§
Source§impl<T> AsyncResponse<T>
impl<T> AsyncResponse<T>
Sourcepub fn status(&self) -> StatusCode
pub fn status(&self) -> StatusCode
Get the status code from the response.
Sourcepub fn deconstruct(self) -> (StatusCode, Headers, AsyncResponseBody)
pub fn deconstruct(self) -> (StatusCode, Headers, AsyncResponseBody)
Deconstruct the HTTP response into its components.
Sourcepub fn into_body(self) -> AsyncResponseBody
pub fn into_body(self) -> AsyncResponseBody
Get the AsyncResponseBody.
§Examples
use typespec_client_core::http::response::AsyncResponse;
let response: AsyncResponse = unimplemented!();
let body: Vec<u8> = response
.into_body()
.collect()
.await?
.to_vec();Trait Implementations§
Source§impl<T> Debug for AsyncResponse<T>
impl<T> Debug for AsyncResponse<T>
Source§impl<T> From<AsyncRawResponse> for AsyncResponse<T>
impl<T> From<AsyncRawResponse> for AsyncResponse<T>
Source§fn from(raw: AsyncRawResponse) -> AsyncResponse<T>
fn from(raw: AsyncRawResponse) -> AsyncResponse<T>
Converts to this type from the input type.
Source§impl<T> From<AsyncResponse<T>> for AsyncRawResponse
impl<T> From<AsyncResponse<T>> for AsyncRawResponse
Source§fn from(response: AsyncResponse<T>) -> AsyncRawResponse
fn from(response: AsyncResponse<T>) -> AsyncRawResponse
Converts to this type from the input type.
Auto Trait Implementations§
impl<T = ()> !Freeze for AsyncResponse<T>
impl<T = ()> !RefUnwindSafe for AsyncResponse<T>
impl<T = ()> !Sync for AsyncResponse<T>
impl<T = ()> !UnwindSafe for AsyncResponse<T>
impl<T> Send for AsyncResponse<T>where
PhantomData<T>: Send,
impl<T> Unpin for AsyncResponse<T>where
PhantomData<T>: Unpin,
impl<T> UnsafeUnpin for AsyncResponse<T>where
PhantomData<T>: UnsafeUnpin,
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
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
Source§fn in_current_span(self) -> Instrumented<Self> ⓘ
fn in_current_span(self) -> Instrumented<Self> ⓘ
Source§impl<T> PolicyExt for Twhere
T: ?Sized,
impl<T> PolicyExt for Twhere
T: ?Sized,
Source§impl<T> ServiceExt for T
impl<T> ServiceExt for T
Source§fn map_response_body<F>(self, f: F) -> MapResponseBody<Self, F>where
Self: Sized,
fn map_response_body<F>(self, f: F) -> MapResponseBody<Self, F>where
Self: Sized,
Apply a transformation to the response body. Read more
Source§fn decompression(self) -> Decompression<Self>where
Self: Sized,
fn decompression(self) -> Decompression<Self>where
Self: Sized,
Decompress response bodies. Read more
Source§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
Source§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