Skip to main content

PduCommon

Struct PduCommon 

Source
pub struct PduCommon {
    pub(crate) event_id: OwnedEventId,
    pub(crate) room_id: OwnedRoomId,
    pub(crate) sender: OwnedUserId,
    pub(crate) event_type: TimelineEventType,
    pub(crate) content: Box<RawValue>,
    pub(crate) state_key: Option<String>,
    pub(crate) origin_server_ts: MilliSecondsSinceUnixEpoch,
    pub(crate) redacts: Option<OwnedEventId>,
    pub(crate) rejected: bool,
    pub(crate) raw: Box<RawValue>,
}
Expand description

Common PDU fields independent of room version format.

Fields§

§event_id: OwnedEventId

Event ID.

§room_id: OwnedRoomId

Room ID.

§sender: OwnedUserId

Event sender.

§event_type: TimelineEventType

Event type.

§content: Box<RawValue>

Event content.

§state_key: Option<String>

State key for state events.

§origin_server_ts: MilliSecondsSinceUnixEpoch

Origin server timestamp.

§redacts: Option<OwnedEventId>

Redacted event ID.

§rejected: bool

Whether the event is rejected.

§raw: Box<RawValue>

Raw PDU JSON.

Implementations§

Source§

impl PduCommon

Source

pub fn event_id(&self) -> &EventId

Get the event ID

Source

pub fn room_id(&self) -> &RoomId

Get the room ID

Source

pub fn sender(&self) -> &UserId

Get the sender

Source

pub const fn event_type(&self) -> &TimelineEventType

Get the event type

Source

pub fn content(&self) -> &RawJsonValue

Get the event content

Source

pub fn state_key(&self) -> Option<&str>

Get the state key

Source

pub const fn origin_server_ts(&self) -> MilliSecondsSinceUnixEpoch

Get the origin server timestamp

Source

pub fn redacts(&self) -> Option<&EventId>

Get the redacted event ID

Source

pub const fn rejected(&self) -> bool

Check if the event is rejected

Source

pub fn raw(&self) -> &RawJsonValue

Get the raw PDU JSON

Trait Implementations§

Source§

impl Clone for PduCommon

Source§

fn clone(&self) -> PduCommon

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for PduCommon

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
§

impl<T> DropFlavorWrapper<T> for T

§

type Flavor = MayDrop

The DropFlavor that [wrap]s T into Self
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

§

impl<T, W> HasTypeWitness<W> for T
where W: MakeTypeWitness<Arg = T>, T: ?Sized,

§

const WITNESS: W = W::MAKE

A constant of the type witness
§

impl<T> Identity for T
where T: ?Sized,

§

const TYPE_EQ: TypeEq<T, <T as Identity>::Type> = TypeEq::NEW

Proof that Self is the same type as Self::Type, provides methods for casting between Self and Self::Type.
§

type Type = T

The same type as Self, used to emulate type equality bounds (T == U) with associated type equality constraints (T: Identity<Type = U>).
§

impl<T> Instrument for T

§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided [Span], returning an Instrumented wrapper. Read more
§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

§

impl<T> JsonCastable<CanonicalJsonValue> for T

§

impl<T> JsonCastable<Value> for T

Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
§

impl<T> WithSubscriber for T

§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a [WithDispatch] wrapper. Read more
§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a [WithDispatch] wrapper. Read more