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: EventTypeThe type of the event.
content_value: StringThe 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: StringThe unique identifier of this event.
sender: StringThe MXID of the user who sent this event.
server_ts: i64Timestamp in milliseconds on the originating Homeserver when this event was sent.
room_id: StringThe ID of the room associated with this event.
source: StringThe 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
impl StructuralPartialEq for Event
Auto Trait Implementations§
impl Freeze for Event
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
Source§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
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.Source§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
Convert
Rc<Trait> (where Trait: Downcast) to Rc<Any>. Rc<Any> can then be
further downcast into Rc<ConcreteType> where ConcreteType implements Trait.Source§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.Source§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.Source§impl<T> DowncastSync for T
impl<T> DowncastSync for T
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>
Converts
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>
Converts
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