pub struct Pdu {Show 15 fields
pub kind: TimelineEventType,
pub content: Content,
pub event_id: OwnedEventId,
pub room_id: OwnedRoomId,
pub sender: OwnedUserId,
pub state_key: Option<StateKey>,
pub redacts: Option<OwnedEventId>,
pub prev_events: PrevEvents,
pub auth_events: AuthEvents,
pub origin_server_ts: UInt,
pub depth: UInt,
pub hashes: EventHash,
pub origin: Option<OwnedServerName>,
pub unsigned: Option<Box<RawValue>>,
pub signatures: Option<Box<RawValue>>,
}Expand description
Persistent Data Unit (Event)
Fields§
§kind: TimelineEventType§content: Content§event_id: OwnedEventId§room_id: OwnedRoomId§sender: OwnedUserId§state_key: Option<StateKey>§redacts: Option<OwnedEventId>§prev_events: PrevEvents§auth_events: AuthEvents§origin_server_ts: UInt§depth: UInt§hashes: EventHash§origin: Option<OwnedServerName>§unsigned: Option<Box<RawValue>>§signatures: Option<Box<RawValue>>Implementations§
Source§impl Pdu
impl Pdu
Sourcepub fn add_membership(&mut self, membership: &MembershipState) -> Result
pub fn add_membership(&mut self, membership: &MembershipState) -> Result
MSC4115: annotate the served event with the requesting user’s room membership at the time of the event.
Source§impl Pdu
impl Pdu
pub fn from_object_and_roomid_and_eventid( room_id: &RoomId, event_id: &EventId, json: CanonicalJsonObject, ) -> Result<Self>
pub fn from_object_and_eventid( event_id: &EventId, json: CanonicalJsonObject, ) -> Result<Self>
pub fn from_object_federation( room_id: &RoomId, event_id: &EventId, json: CanonicalJsonObject, rules: &RoomVersionRules, ) -> Result<(Self, CanonicalJsonObject)>
pub fn from_object_checked( json: CanonicalJsonObject, rules: &RoomVersionRules, ) -> Result<Self>
pub fn from_object(json: CanonicalJsonObject) -> Result<Self>
pub fn from_raw_value(json: &RawJsonValue) -> Result<Self>
pub fn from_value(json: CanonicalJsonValue) -> Result<Self>
pub fn from_raw_json(json: &RawJsonValue) -> Result<Self>
Trait Implementations§
Source§impl<'de> Deserialize<'de> for Pdu
impl<'de> Deserialize<'de> for Pdu
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Source§impl Event for &Pduwhere
Self: Send,
impl Event for &Pduwhere
Self: Send,
Source§fn auth_events(
&self,
) -> impl DoubleEndedIterator<Item = &EventId> + Clone + Send + '_
fn auth_events( &self, ) -> impl DoubleEndedIterator<Item = &EventId> + Clone + Send + '_
Source§fn auth_events_into(
self,
) -> impl IntoIterator<IntoIter = impl Iterator<Item = OwnedEventId>> + Send
fn auth_events_into( self, ) -> impl IntoIterator<IntoIter = impl Iterator<Item = OwnedEventId>> + Send
Source§fn content(&self) -> &RawJsonValue
fn content(&self) -> &RawJsonValue
Source§fn origin_server_ts(&self) -> MilliSecondsSinceUnixEpoch
fn origin_server_ts(&self) -> MilliSecondsSinceUnixEpoch
Source§fn prev_events(
&self,
) -> impl DoubleEndedIterator<Item = &EventId> + Clone + Send + '_
fn prev_events( &self, ) -> impl DoubleEndedIterator<Item = &EventId> + Clone + Send + '_
Source§fn redacts(&self) -> Option<&EventId>
fn redacts(&self) -> Option<&EventId>
Source§fn unsigned(&self) -> Option<&RawJsonValue>
fn unsigned(&self) -> Option<&RawJsonValue>
fn as_pdu(&self) -> &Pdu
fn into_pdu(self) -> Pdu
fn is_owned(&self) -> bool
fn is_type_and_state_key( &self, kind: &TimelineEventType, state_key: &str, ) -> bool
Source§fn into_format<T>(self) -> T
fn into_format<T>(self) -> T
fn contains_unsigned_property<T>(&self, property: &str, is_type: T) -> bool
fn get_unsigned_property<T>(&self, property: &str) -> Result<T>where
T: for<'de> Deserialize<'de>,
Self: Sized,
fn get_unsigned_as_value(&self) -> JsonValuewhere
Self: Sized,
fn get_unsigned<T>(&self) -> Result<T>where
T: for<'de> Deserialize<'de>,
Self: Sized,
fn get_content_as_value(&self) -> JsonValuewhere
Self: Sized,
fn get_content<T>(&self) -> Result<T>where
for<'de> T: Deserialize<'de>,
Self: Sized,
fn redacts_id(&self, room_rules: &RoomVersionRules) -> Option<OwnedEventId>where
Self: Sized,
fn is_redacted(&self) -> boolwhere
Self: Sized,
fn into_canonical_object(self) -> CanonicalJsonObjectwhere
Self: Sized,
fn to_canonical_object(&self) -> CanonicalJsonObject
fn into_value(self) -> JsonValuewhere
Self: Sized,
fn to_value(&self) -> JsonValue
fn as_mut_pdu(&mut self) -> &mut Pdu
fn event_type(&self) -> &TimelineEventType
Source§impl Event for Pdu
impl Event for Pdu
Source§fn auth_events(
&self,
) -> impl DoubleEndedIterator<Item = &EventId> + Clone + Send + '_
fn auth_events( &self, ) -> impl DoubleEndedIterator<Item = &EventId> + Clone + Send + '_
Source§fn auth_events_into(
self,
) -> impl IntoIterator<IntoIter = impl Iterator<Item = OwnedEventId>> + Send
fn auth_events_into( self, ) -> impl IntoIterator<IntoIter = impl Iterator<Item = OwnedEventId>> + Send
Source§fn content(&self) -> &RawJsonValue
fn content(&self) -> &RawJsonValue
Source§fn origin_server_ts(&self) -> MilliSecondsSinceUnixEpoch
fn origin_server_ts(&self) -> MilliSecondsSinceUnixEpoch
Source§fn prev_events(
&self,
) -> impl DoubleEndedIterator<Item = &EventId> + Clone + Send + '_
fn prev_events( &self, ) -> impl DoubleEndedIterator<Item = &EventId> + Clone + Send + '_
Source§fn redacts(&self) -> Option<&EventId>
fn redacts(&self) -> Option<&EventId>
Source§fn unsigned(&self) -> Option<&RawJsonValue>
fn unsigned(&self) -> Option<&RawJsonValue>
fn as_mut_pdu(&mut self) -> &mut Pdu
fn as_pdu(&self) -> &Pdu
fn into_pdu(self) -> Pdu
fn is_owned(&self) -> bool
fn is_type_and_state_key( &self, kind: &TimelineEventType, state_key: &str, ) -> bool
Source§fn into_format<T>(self) -> T
fn into_format<T>(self) -> T
fn contains_unsigned_property<T>(&self, property: &str, is_type: T) -> bool
fn get_unsigned_property<T>(&self, property: &str) -> Result<T>where
T: for<'de> Deserialize<'de>,
Self: Sized,
fn get_unsigned_as_value(&self) -> JsonValuewhere
Self: Sized,
fn get_unsigned<T>(&self) -> Result<T>where
T: for<'de> Deserialize<'de>,
Self: Sized,
fn get_content_as_value(&self) -> JsonValuewhere
Self: Sized,
fn get_content<T>(&self) -> Result<T>where
for<'de> T: Deserialize<'de>,
Self: Sized,
fn redacts_id(&self, room_rules: &RoomVersionRules) -> Option<OwnedEventId>where
Self: Sized,
fn is_redacted(&self) -> boolwhere
Self: Sized,
fn into_canonical_object(self) -> CanonicalJsonObjectwhere
Self: Sized,
fn to_canonical_object(&self) -> CanonicalJsonObject
fn into_value(self) -> JsonValuewhere
Self: Sized,
fn to_value(&self) -> JsonValue
fn event_type(&self) -> &TimelineEventType
Source§impl Ord for Pdu
Ordering determined by the Pdu’s ID, not the memory representations.
impl Ord for Pdu
Ordering determined by the Pdu’s ID, not the memory representations.
1.21.0 (const: unstable) · Source§fn max(self, other: Self) -> Selfwhere
Self: Sized,
fn max(self, other: Self) -> Selfwhere
Self: Sized,
Source§impl PartialOrd for Pdu
Ordering determined by the Pdu’s ID, not the memory representations.
impl PartialOrd for Pdu
Ordering determined by the Pdu’s ID, not the memory representations.
impl Eq for Pdu
Prevent derived equality which wouldn’t limit itself to event_id
Auto Trait Implementations§
impl Freeze for Pdu
impl RefUnwindSafe for Pdu
impl Send for Pdu
impl Sync for Pdu
impl Unpin for Pdu
impl UnsafeUnpin for Pdu
impl UnwindSafe for Pdu
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§impl<Q, K> Comparable<K> for Q
impl<Q, K> Comparable<K> for Q
§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.Source§impl<T> ExpectInto for T
impl<T> ExpectInto for T
fn expect_into<Dst: TryFrom<Self>>(self) -> Dstwhere
Self: Sized,
Source§impl<T> Expected for T
impl<T> Expected for T
fn expected_add(self, rhs: Self) -> Selfwhere
Self: CheckedAdd + Sized,
fn expected_sub(self, rhs: Self) -> Selfwhere
Self: CheckedSub + Sized,
fn expected_mul(self, rhs: Self) -> Selfwhere
Self: CheckedMul + Sized,
fn expected_div(self, rhs: Self) -> Selfwhere
Self: CheckedDiv + Sized,
fn expected_rem(self, rhs: Self) -> Selfwhere
Self: CheckedRem + Sized,
§impl<T> Identity for Twhere
T: ?Sized,
impl<T> Identity for Twhere
T: ?Sized,
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§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>
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>
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 more§impl<T> Paint for Twhere
T: ?Sized,
impl<T> Paint for Twhere
T: ?Sized,
§fn fg(&self, value: Color) -> Painted<&T>
fn fg(&self, value: Color) -> Painted<&T>
Returns a styled value derived from self with the foreground set to
value.
This method should be used rarely. Instead, prefer to use color-specific
builder methods like red() and
green(), which have the same functionality but are
pithier.
§Example
Set foreground color to white using fg():
use yansi::{Paint, Color};
painted.fg(Color::White);Set foreground color to white using white().
use yansi::Paint;
painted.white();§fn bright_black(&self) -> Painted<&T>
fn bright_black(&self) -> Painted<&T>
§fn bright_red(&self) -> Painted<&T>
fn bright_red(&self) -> Painted<&T>
§fn bright_green(&self) -> Painted<&T>
fn bright_green(&self) -> Painted<&T>
§fn bright_yellow(&self) -> Painted<&T>
fn bright_yellow(&self) -> Painted<&T>
§fn bright_blue(&self) -> Painted<&T>
fn bright_blue(&self) -> Painted<&T>
§fn bright_magenta(&self) -> Painted<&T>
fn bright_magenta(&self) -> Painted<&T>
§fn bright_cyan(&self) -> Painted<&T>
fn bright_cyan(&self) -> Painted<&T>
§fn bright_white(&self) -> Painted<&T>
fn bright_white(&self) -> Painted<&T>
§fn bg(&self, value: Color) -> Painted<&T>
fn bg(&self, value: Color) -> Painted<&T>
Returns a styled value derived from self with the background set to
value.
This method should be used rarely. Instead, prefer to use color-specific
builder methods like on_red() and
on_green(), which have the same functionality but
are pithier.
§Example
Set background color to red using fg():
use yansi::{Paint, Color};
painted.bg(Color::Red);Set background color to red using on_red().
use yansi::Paint;
painted.on_red();§fn on_primary(&self) -> Painted<&T>
fn on_primary(&self) -> Painted<&T>
§fn on_magenta(&self) -> Painted<&T>
fn on_magenta(&self) -> Painted<&T>
§fn on_bright_black(&self) -> Painted<&T>
fn on_bright_black(&self) -> Painted<&T>
§fn on_bright_red(&self) -> Painted<&T>
fn on_bright_red(&self) -> Painted<&T>
§fn on_bright_green(&self) -> Painted<&T>
fn on_bright_green(&self) -> Painted<&T>
§fn on_bright_yellow(&self) -> Painted<&T>
fn on_bright_yellow(&self) -> Painted<&T>
§fn on_bright_blue(&self) -> Painted<&T>
fn on_bright_blue(&self) -> Painted<&T>
§fn on_bright_magenta(&self) -> Painted<&T>
fn on_bright_magenta(&self) -> Painted<&T>
§fn on_bright_cyan(&self) -> Painted<&T>
fn on_bright_cyan(&self) -> Painted<&T>
§fn on_bright_white(&self) -> Painted<&T>
fn on_bright_white(&self) -> Painted<&T>
§fn attr(&self, value: Attribute) -> Painted<&T>
fn attr(&self, value: Attribute) -> Painted<&T>
Enables the styling [Attribute] value.
This method should be used rarely. Instead, prefer to use
attribute-specific builder methods like bold() and
underline(), which have the same functionality
but are pithier.
§Example
Make text bold using attr():
use yansi::{Paint, Attribute};
painted.attr(Attribute::Bold);Make text bold using using bold().
use yansi::Paint;
painted.bold();§fn rapid_blink(&self) -> Painted<&T>
fn rapid_blink(&self) -> Painted<&T>
§fn quirk(&self, value: Quirk) -> Painted<&T>
fn quirk(&self, value: Quirk) -> Painted<&T>
Enables the yansi [Quirk] value.
This method should be used rarely. Instead, prefer to use quirk-specific
builder methods like mask() and
wrap(), which have the same functionality but are
pithier.
§Example
Enable wrapping using .quirk():
use yansi::{Paint, Quirk};
painted.quirk(Quirk::Wrap);Enable wrapping using wrap().
use yansi::Paint;
painted.wrap();§fn clear(&self) -> Painted<&T>
👎Deprecated since 1.0.1: renamed to resetting() due to conflicts with Vec::clear().
The clear() method will be removed in a future release.
fn clear(&self) -> Painted<&T>
renamed to resetting() due to conflicts with Vec::clear().
The clear() method will be removed in a future release.
§fn whenever(&self, value: Condition) -> Painted<&T>
fn whenever(&self, value: Condition) -> Painted<&T>
Conditionally enable styling based on whether the [Condition] value
applies. Replaces any previous condition.
See the crate level docs for more details.
§Example
Enable styling painted only when both stdout and stderr are TTYs:
use yansi::{Paint, Condition};
painted.red().on_yellow().whenever(Condition::STDOUTERR_ARE_TTY);§impl<T> PolicyExt for Twhere
T: ?Sized,
impl<T> PolicyExt for Twhere
T: ?Sized,
§impl<T> ServiceExt for T
impl<T> ServiceExt for T
§fn add_extension<T>(self, value: T) -> AddExtension<Self, T>where
Self: Sized,
fn add_extension<T>(self, value: T) -> AddExtension<Self, T>where
Self: Sized,
§fn compression(self) -> Compression<Self>where
Self: Sized,
fn compression(self) -> Compression<Self>where
Self: Sized,
§fn decompression(self) -> Decompression<Self>where
Self: Sized,
fn decompression(self) -> Decompression<Self>where
Self: Sized,
§fn trace_for_http(self) -> Trace<Self, SharedClassifier<ServerErrorsAsFailures>>where
Self: Sized,
fn trace_for_http(self) -> Trace<Self, SharedClassifier<ServerErrorsAsFailures>>where
Self: Sized,
§fn trace_for_grpc(self) -> Trace<Self, SharedClassifier<GrpcErrorsAsFailures>>where
Self: Sized,
fn trace_for_grpc(self) -> Trace<Self, SharedClassifier<GrpcErrorsAsFailures>>where
Self: Sized,
§fn follow_redirects(self) -> FollowRedirect<Self>where
Self: Sized,
fn follow_redirects(self) -> FollowRedirect<Self>where
Self: Sized,
§fn sensitive_headers(
self,
headers: impl IntoIterator<Item = HeaderName>,
) -> SetSensitiveRequestHeaders<SetSensitiveResponseHeaders<Self>>where
Self: Sized,
fn sensitive_headers(
self,
headers: impl IntoIterator<Item = HeaderName>,
) -> SetSensitiveRequestHeaders<SetSensitiveResponseHeaders<Self>>where
Self: Sized,
§fn sensitive_request_headers(
self,
headers: impl IntoIterator<Item = HeaderName>,
) -> SetSensitiveRequestHeaders<Self>where
Self: Sized,
fn sensitive_request_headers(
self,
headers: impl IntoIterator<Item = HeaderName>,
) -> SetSensitiveRequestHeaders<Self>where
Self: Sized,
§fn sensitive_response_headers(
self,
headers: impl IntoIterator<Item = HeaderName>,
) -> SetSensitiveResponseHeaders<Self>where
Self: Sized,
fn sensitive_response_headers(
self,
headers: impl IntoIterator<Item = HeaderName>,
) -> SetSensitiveResponseHeaders<Self>where
Self: Sized,
§fn override_request_header<M>(
self,
header_name: HeaderName,
make: M,
) -> SetRequestHeader<Self, M>where
Self: Sized,
fn override_request_header<M>(
self,
header_name: HeaderName,
make: M,
) -> SetRequestHeader<Self, M>where
Self: Sized,
§fn append_request_header<M>(
self,
header_name: HeaderName,
make: M,
) -> SetRequestHeader<Self, M>where
Self: Sized,
fn append_request_header<M>(
self,
header_name: HeaderName,
make: M,
) -> SetRequestHeader<Self, M>where
Self: Sized,
§fn insert_request_header_if_not_present<M>(
self,
header_name: HeaderName,
make: M,
) -> SetRequestHeader<Self, M>where
Self: Sized,
fn insert_request_header_if_not_present<M>(
self,
header_name: HeaderName,
make: M,
) -> SetRequestHeader<Self, M>where
Self: Sized,
§fn override_response_header<M>(
self,
header_name: HeaderName,
make: M,
) -> SetResponseHeader<Self, M>where
Self: Sized,
fn override_response_header<M>(
self,
header_name: HeaderName,
make: M,
) -> SetResponseHeader<Self, M>where
Self: Sized,
§fn append_response_header<M>(
self,
header_name: HeaderName,
make: M,
) -> SetResponseHeader<Self, M>where
Self: Sized,
fn append_response_header<M>(
self,
header_name: HeaderName,
make: M,
) -> SetResponseHeader<Self, M>where
Self: Sized,
§fn insert_response_header_if_not_present<M>(
self,
header_name: HeaderName,
make: M,
) -> SetResponseHeader<Self, M>where
Self: Sized,
fn insert_response_header_if_not_present<M>(
self,
header_name: HeaderName,
make: M,
) -> SetResponseHeader<Self, M>where
Self: Sized,
§fn catch_panic(self) -> CatchPanic<Self, DefaultResponseForPanic>where
Self: Sized,
fn catch_panic(self) -> CatchPanic<Self, DefaultResponseForPanic>where
Self: Sized,
500 Internal Server responses. Read more