#[non_exhaustive]pub struct Response {
pub event_or_content: Box<RawValue>,
}
api
and (crate features client-api-c
or client-api-s
) only.Expand description
Response type for the get_state_events_for_key
endpoint, either the Raw
AnyStateEvent
or AnyStateEventContent
.
While it’s possible to access the raw value directly, it’s recommended you use the
provided helper methods to access it, and From
to create it.
Fields (Non-exhaustive)§
This struct is marked as non-exhaustive
Struct { .. }
syntax; cannot be matched against without a wildcard ..
; and struct update syntax will not work.event_or_content: Box<RawValue>
The full event (content) of the state event.
Implementations§
Source§impl Response
impl Response
Sourcepub fn new(event_or_content: Box<RawValue>) -> Response
pub fn new(event_or_content: Box<RawValue>) -> Response
Creates a new Response
with the given event (content).
Sourcepub fn into_event(self) -> Raw<AnyStateEvent>
pub fn into_event(self) -> Raw<AnyStateEvent>
Returns an unchecked Raw<AnyStateEvent>
.
This method should only be used if you specified the format
in the request to be
StateEventFormat::Event
Sourcepub fn into_content(self) -> Raw<AnyStateEventContent>
pub fn into_content(self) -> Raw<AnyStateEventContent>
Returns an unchecked Raw<AnyStateEventContent>
.
This method should only be used if you did not specify the format
in the request, or
set it to be StateEventFormat::Content
Since the inner type of the Raw
does not implement Deserialize
, you need to use
.deserialize_as_unchecked::<T>()
or
.cast_ref_unchecked::<T>().deserialize_with_type()
to deserialize it.
Trait Implementations§
Source§impl IncomingResponse for Response
impl IncomingResponse for Response
Source§type EndpointError = Error
type EndpointError = Error
Source§fn try_from_http_response<T>(
response: Response<T>,
) -> Result<Response, FromHttpResponseError<Error>>
fn try_from_http_response<T>( response: Response<T>, ) -> Result<Response, FromHttpResponseError<Error>>
http::Response
into this response type.Source§impl OutgoingResponse for Response
impl OutgoingResponse for Response
Source§fn try_into_http_response<T>(self) -> Result<Response<T>, IntoHttpError>
fn try_into_http_response<T>(self) -> Result<Response<T>, IntoHttpError>
http::Response
. Read more