Struct icu_provider::DataResponse
source · pub struct DataResponse<M>where
M: DataMarker,{
pub metadata: DataResponseMetadata,
pub payload: Option<DataPayload<M>>,
}
Expand description
A response object containing an object as payload and metadata about it.
Fields§
§metadata: DataResponseMetadata
Metadata about the returned object.
payload: Option<DataPayload<M>>
The object itself; None if it was not loaded.
Implementations§
source§impl<M> DataResponse<M>where
M: DataMarker,
impl<M> DataResponse<M>where M: DataMarker,
sourcepub fn take_payload(self) -> Result<DataPayload<M>, DataError>
pub fn take_payload(self) -> Result<DataPayload<M>, DataError>
Takes ownership of the underlying payload. Error if not present.
To take the metadata, too, use Self::take_metadata_and_payload()
.
sourcepub fn take_metadata_and_payload(
self
) -> Result<(DataResponseMetadata, DataPayload<M>), DataError>
pub fn take_metadata_and_payload( self ) -> Result<(DataResponseMetadata, DataPayload<M>), DataError>
Takes ownership of the underlying metadata and payload. Error if payload is not present.
source§impl<M> DataResponse<M>where
M: DataMarker,
M::Yokeable: MaybeSendSync,
impl<M> DataResponse<M>where M: DataMarker, M::Yokeable: MaybeSendSync,
sourcepub fn wrap_into_any_response(self) -> AnyResponse
pub fn wrap_into_any_response(self) -> AnyResponse
Moves the inner DataPayload to the heap (requiring an allocation) and returns it as an
erased AnyResponse
.
Trait Implementations§
source§impl<M> Clone for DataResponse<M>where
M: DataMarker,
for<'a> YokeTraitHack<<M::Yokeable as Yokeable<'a>>::Output>: Clone,
impl<M> Clone for DataResponse<M>where M: DataMarker, for<'a> YokeTraitHack<<M::Yokeable as Yokeable<'a>>::Output>: Clone,
source§impl<M> Debug for DataResponse<M>where
M: DataMarker,
for<'a> &'a <M::Yokeable as Yokeable<'a>>::Output: Debug,
impl<M> Debug for DataResponse<M>where M: DataMarker, for<'a> &'a <M::Yokeable as Yokeable<'a>>::Output: Debug,
source§impl From<AnyResponse> for DataResponse<AnyMarker>
impl From<AnyResponse> for DataResponse<AnyMarker>
source§fn from(other: AnyResponse) -> Self
fn from(other: AnyResponse) -> Self
Converts to this type from the input type.