pub struct Event {
pub event_type: EventType,
pub content_value: String,
pub msgtype: Option<String>,
pub event_id: String,
pub sender: String,
pub server_ts: i64,
pub room_id: String,
pub source: String,
}
Expand description
Matrix event that can be added to the database.
Fields§
§event_type: EventType
The type of the event.
content_value: String
The textual representation of a message, this part of the event will be indexed.
msgtype: Option<String>
The type of the message if the event is of a m.room.message type.
event_id: String
The unique identifier of this event.
sender: String
The MXID of the user who sent this event.
server_ts: i64
Timestamp in milliseconds on the originating Homeserver when this event was sent.
room_id: String
The ID of the room associated with this event.
source: String
The serialized JSON string of the event. This string will be returned by a search later on.
Implementations§
source§impl Event
impl Event
sourcepub fn new(
event_type: EventType,
content_value: &str,
msgtype: Option<&str>,
event_id: &str,
sender: &str,
server_ts: i64,
room_id: &str,
source: &str
) -> Event
pub fn new( event_type: EventType, content_value: &str, msgtype: Option<&str>, event_id: &str, sender: &str, server_ts: i64, room_id: &str, source: &str ) -> Event
Create a new event.
Arguments
event_type
- The type of the event.content_value
- The plain text value of the content, body for a message event, topic for a topic event and name for a name event.event_id
- The unique identifier of the event.sender
- The unique identifier of the event author.server_ts
- The timestamp of the event.room_id
- The unique identifier of the room that the event belongs to.source
- The serialized version of the event.
Trait Implementations§
source§impl<'de> Deserialize<'de> for Event
impl<'de> Deserialize<'de> for Event
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>,
Deserialize this value from the given Serde deserializer. Read more
source§impl PartialEq<Event> for Event
impl PartialEq<Event> for Event
impl StructuralPartialEq for Event
Auto Trait Implementations§
impl RefUnwindSafe for Event
impl Send for Event
impl Sync for Event
impl Unpin for Event
impl UnwindSafe for Event
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
Mutably borrows from an owned value. Read more
§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere T: Any,
§fn into_any(self: Box<T, Global>) -> Box<dyn Any + 'static, Global>
fn into_any(self: Box<T, Global>) -> Box<dyn Any + 'static, Global>
Convert
Box<dyn Trait>
(where Trait: Downcast
) to Box<dyn Any>
. Box<dyn Any>
can
then be further downcast
into Box<ConcreteType>
where ConcreteType
implements Trait
.§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any + 'static>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any + 'static>
Convert
Rc<Trait>
(where Trait: Downcast
) to Rc<Any>
. Rc<Any>
can then be
further downcast
into Rc<ConcreteType>
where ConcreteType
implements Trait
.§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
Convert
&Trait
(where Trait: Downcast
) to &Any
. This is needed since Rust cannot
generate &Any
’s vtable from &Trait
’s.§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
Convert
&mut Trait
(where Trait: Downcast
) to &Any
. This is needed since Rust cannot
generate &mut Any
’s vtable from &mut Trait
’s.