pub enum Payload<JsonType> {
None,
Json(JsonType),
Octets(Bytes),
}Expand description
Payload of a request or response to an api endpoint.
Variants§
None
Json(JsonType)
This is the regular response type used by the pubhubs API.
Octets(Bytes)
Raw bytes; used, for example, by crate::api::phc::user::GetObjectEP.
Implementations§
Source§impl<T> Payload<T>
impl<T> Payload<T>
Sourcepub fn content_type(&self) -> Option<ContentType>
pub fn content_type(&self) -> Option<ContentType>
Returns the content type appropriate for this payload
Sourcepub fn into_body(self) -> Result<Option<Bytes>>where
T: Serialize,
pub fn into_body(self) -> Result<Option<Bytes>>where
T: Serialize,
Converts this payload into bytes.
Sourcepub async fn from_client_response<S>(
resp: ClientResponse<S>,
) -> Result<Payload<T>>
pub async fn from_client_response<S>( resp: ClientResponse<S>, ) -> Result<Payload<T>>
Extracts payload from awc::ClientResponse.
Trait Implementations§
Source§impl<T> PayloadTrait for Payload<T>
impl<T> PayloadTrait for Payload<T>
Source§impl<T> ResultPayloadTrait for Payload<Result<T>>
impl<T> ResultPayloadTrait for Payload<Result<T>>
Auto Trait Implementations§
impl<JsonType> !Freeze for Payload<JsonType>
impl<JsonType> RefUnwindSafe for Payload<JsonType>where
JsonType: RefUnwindSafe,
impl<JsonType> Send for Payload<JsonType>where
JsonType: Send,
impl<JsonType> Sync for Payload<JsonType>where
JsonType: Sync,
impl<JsonType> Unpin for Payload<JsonType>where
JsonType: Unpin,
impl<JsonType> UnsafeUnpin for Payload<JsonType>where
JsonType: UnsafeUnpin,
impl<JsonType> UnwindSafe for Payload<JsonType>where
JsonType: UnwindSafe,
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> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§impl<T> PolicyExt for Twhere
T: ?Sized,
impl<T> PolicyExt for Twhere
T: ?Sized,
Source§impl<T> ToStringFallible for Twhere
T: Display,
impl<T> ToStringFallible for Twhere
T: Display,
Source§fn try_to_string(&self) -> Result<String, TryReserveError>
fn try_to_string(&self) -> Result<String, TryReserveError>
ToString::to_string, but without panic on OOM.