pub struct Message {
pub time: u64,
pub sender: Option<String>,
pub content: String,
pub html: bool,
}Expand description
A global out-game chat message.
§Time Order
The Self::sender fields indicates the local timestamp on the client when and where this message is sent.
No guarantee is made about the consistency of the time order of message.
§HTML
The message can either be a plain text message (when Self::html is set to false)
or an HTML message (when Self::html is set to true).
§Caution
Only constrait to Self::content is the same as that of String, i.e. to be valid UTF-8,
even if Self::html is on.
Therefore, no guarantee is made about whether it is valid DOM element or HTML.
Appropriate checks shall be done before attempting to render HTML to avoid potential danger.
Fields§
§time: u64Milisecond UNIX timestamp when the message is sent.
sender: Option<String>The user who sends the message.
A None indicates that this message is a broadcast triggered by a server command.
content: StringContent of the chat.
This field shall be interpreted with respect to Self::html as plain text or string of HTML.
html: boolWhether HTML is enabled in the content of the message.
Trait Implementations§
Source§impl<'de> Deserialize<'de> for Message
impl<'de> Deserialize<'de> for Message
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>,
Auto Trait Implementations§
impl Freeze for Message
impl RefUnwindSafe for Message
impl Send for Message
impl Sync for Message
impl Unpin for Message
impl UnwindSafe for Message
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,
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>
Box<dyn Trait> (where Trait: Downcast) to Box<dyn Any>, which can then be
downcast into Box<dyn 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>
Rc<Trait> (where Trait: Downcast) to Rc<Any>, which 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)
&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)
&mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &mut Any’s vtable from &mut Trait’s.