[][src]Struct matrix_bot_api::Message

pub struct Message {
    pub sender: String,
    pub mtype: String,
    pub body: String,
    pub date: DateTime<Local>,
    pub room: String,
    pub thumb: Option<String>,
    pub url: Option<String>,
    pub id: String,
    pub formatted_body: Option<String>,
    pub format: Option<String>,
    pub source: Option<String>,
    pub receipt: HashMap<String, i64, RandomState>,
    pub redacted: bool,
    pub in_reply_to: Option<String>,
    pub extra_content: Option<Value>,
}

Fields

sender: Stringmtype: Stringbody: Stringdate: DateTime<Local>room: Stringthumb: Option<String>url: Option<String>id: Stringformatted_body: Option<String>format: Option<String>source: Option<String>receipt: HashMap<String, i64, RandomState>redacted: boolin_reply_to: Option<String>extra_content: Option<Value>

Methods

impl Message[src]

pub fn new(room: String, sender: String, body: String, mtype: String) -> Message[src]

pub fn types() -> [&'static str; 2][src]

List all supported types. By default a message map a m.room.message event, but there's other events that we want to show in the message history so we map other event types to our Message struct, like stickers

pub fn supported_event(ev: &&Value) -> bool[src]

Helper function to use in iterator filter of a matrix.org json response to filter supported events

pub fn parse_room_message(roomid: &str, msg: &Value) -> Message[src]

Parses a matrix.org event and return a Message object

Arguments

  • roomid - The message room id
  • msg - The message event as Json

pub fn from_json_events_iter<'a, I>(roomid: &str, events: I) -> Vec<Message> where
    I: Iterator<Item = &'a Value>, 
[src]

Create a vec of Message from a json event list

  • roomid - The messages room id
  • events - An iterator to the json events

pub fn set_receipt(&mut self, receipt: HashMap<String, i64, RandomState>)[src]

Trait Implementations

impl Clone for Message[src]

impl Debug for Message[src]

impl<'de> Deserialize<'de> for Message[src]

impl PartialEq<Message> for Message[src]

impl PartialOrd<Message> for Message[src]

impl Serialize for Message[src]

Auto Trait Implementations

impl RefUnwindSafe for Message

impl Send for Message

impl Sync for Message

impl Unpin for Message

impl UnwindSafe for Message

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> DeserializeOwned for T where
    T: Deserialize<'de>, 
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

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

The type returned in the event of a conversion error.

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

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