pub struct ChatMessage {
pub key: MessageKey,
pub msgid: Option<String>,
pub sender: String,
pub kind: MessageKind,
pub text: String,
pub account: Option<String>,
pub historical: bool,
pub own: bool,
pub reply_to: Option<String>,
pub reactions: BTreeMap<String, Vec<String>>,
pub link_preview: Option<LinkPreview>,
pub redacted: bool,
}Expand description
One message, as the model holds it.
Fields§
§key: MessageKeyWhere it sits in the log.
msgid: Option<String>The network-unique id, when the server assigned one.
sender: StringWho sent it, as they spell their own nick.
kind: MessageKindWhat kind of event it is.
text: StringThe body, empty for events that have none.
account: Option<String>The account the sender was logged in as, from account-tag.
historical: boolTrue when this arrived inside a history batch rather than live.
own: boolTrue when this is our own message coming back through echo-message.
reply_to: Option<String>The message this one replies to, from the +reply tag.
The server is inconsistent about the spelling and sends +reply from one module and
+draft/reply from another, so both are accepted on the way in.
reactions: BTreeMap<String, Vec<String>>Reactions, keyed by the emoji, holding who reacted.
link_preview: Option<LinkPreview>A preview of the first link in this message, when the server built one.
redacted: boolTrue once the message was redacted. The original is kept, because throwing it away leaves no way to show who redacted what.
Implementations§
Source§impl ChatMessage
impl ChatMessage
Sourcepub fn new(
key: MessageKey,
sender: impl Into<String>,
kind: MessageKind,
) -> Self
pub fn new( key: MessageKey, sender: impl Into<String>, kind: MessageKind, ) -> Self
A message with only what every kind carries.
Trait Implementations§
Source§impl Clone for ChatMessage
impl Clone for ChatMessage
Source§fn clone(&self) -> ChatMessage
fn clone(&self) -> ChatMessage
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for ChatMessage
impl Debug for ChatMessage
Source§impl<'de> Deserialize<'de> for ChatMessage
impl<'de> Deserialize<'de> for ChatMessage
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>,
impl Eq for ChatMessage
Source§impl PartialEq for ChatMessage
impl PartialEq for ChatMessage
Source§fn eq(&self, other: &ChatMessage) -> bool
fn eq(&self, other: &ChatMessage) -> bool
self and other values to be equal, and is used by ==.Source§impl Serialize for ChatMessage
impl Serialize for ChatMessage
impl StructuralPartialEq for ChatMessage
Source§impl TS for ChatMessage
impl TS for ChatMessage
Source§const DOCS: Option<&'static str>
const DOCS: Option<&'static str>
TS is derived, docs are
automatically read from your doc comments or #[doc = ".."] attributesSource§type WithoutGenerics = ChatMessage
type WithoutGenerics = ChatMessage
WithoutGenerics should just be Self.
If the type does have generic parameters, then all generic parameters must be replaced with
a dummy type, e.g ts_rs::Dummy or ().
The only requirement for these dummy types is that EXPORT_TO must be None. Read moreSource§fn decl_concrete() -> String
fn decl_concrete() -> String
TS::decl().
If this type is not generic, then this function is equivalent to TS::decl().Source§fn decl() -> String
fn decl() -> String
type User = { user_id: number, ... }.
This function will panic if the type has no declaration. Read moreSource§fn inline() -> String
fn inline() -> String
{ user_id: number }.
This function will panic if the type cannot be inlined.Source§fn inline_flattened() -> String
fn inline_flattened() -> String
This function will panic if the type cannot be flattened.
Source§fn visit_generics(v: &mut impl TypeVisitor)where
Self: 'static,
fn visit_generics(v: &mut impl TypeVisitor)where
Self: 'static,
Source§fn output_path() -> Option<&'static Path>
fn output_path() -> Option<&'static Path>
T should be exported.The returned path does not include the base directory from
TS_RS_EXPORT_DIR. Read moreSource§fn visit_dependencies(v: &mut impl TypeVisitor)where
Self: 'static,
fn visit_dependencies(v: &mut impl TypeVisitor)where
Self: 'static,
§fn dependencies() -> Vec<Dependency>where
Self: 'static,
fn dependencies() -> Vec<Dependency>where
Self: 'static,
§fn export() -> Result<(), ExportError>where
Self: 'static,
fn export() -> Result<(), ExportError>where
Self: 'static,
TS::export_all]. Read more§fn export_all() -> Result<(), ExportError>where
Self: 'static,
fn export_all() -> Result<(), ExportError>where
Self: 'static,
To export only this type, without its dependencies, use [
TS::export]. Read more§fn export_all_to(out_dir: impl AsRef<Path>) -> Result<(), ExportError>where
Self: 'static,
fn export_all_to(out_dir: impl AsRef<Path>) -> Result<(), ExportError>where
Self: 'static,
To export only this type, without its dependencies, use [
TS::export]. Read more§fn export_to_string() -> Result<String, ExportError>where
Self: 'static,
fn export_to_string() -> Result<String, ExportError>where
Self: 'static,
§fn default_output_path() -> Option<PathBuf>
fn default_output_path() -> Option<PathBuf>
T should be exported. Read more