#[non_exhaustive]pub struct Response {
pub event_or_content: Box<RawValue>,
}
client
or server
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<RawJsonValue>) -> Self
pub fn new(event_or_content: Box<RawJsonValue>) -> Self
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 From<Raw<AnyStateEvent>> for Response
impl From<Raw<AnyStateEvent>> for Response
Source§fn from(value: Raw<AnyStateEvent>) -> Self
fn from(value: Raw<AnyStateEvent>) -> Self
Source§impl From<Raw<AnyStateEventContent>> for Response
impl From<Raw<AnyStateEventContent>> for Response
Source§fn from(value: Raw<AnyStateEventContent>) -> Self
fn from(value: Raw<AnyStateEventContent>) -> Self
Source§impl IncomingResponse for Response
Available on crate feature client
only.
impl IncomingResponse for Response
client
only.Source§type EndpointError = Error
type EndpointError = Error
Source§fn try_from_http_response<T: AsRef<[u8]>>(
response: Response<T>,
) -> Result<Self, FromHttpResponseError<Error>>
fn try_from_http_response<T: AsRef<[u8]>>( response: Response<T>, ) -> Result<Self, FromHttpResponseError<Error>>
http::Response
into this response type.Source§impl OutgoingResponse for Response
Available on crate feature server
only.
impl OutgoingResponse for Response
server
only.Source§fn try_into_http_response<T: Default + BufMut>(
self,
) -> Result<Response<T>, IntoHttpError>
fn try_into_http_response<T: Default + BufMut>( self, ) -> Result<Response<T>, IntoHttpError>
http::Response
. Read more