Enum Message

Source
pub enum Message {
    Text {
        body: String,
        formatted_body: Option<String>,
        format: Option<String>,
    },
    Notice {
        body: String,
        formatted_body: Option<String>,
        format: Option<String>,
    },
    Image {
        body: String,
        url: String,
        info: Option<ImageInfo>,
        thumbnail_url: Option<String>,
        thumbnail_info: Option<ImageInfo>,
    },
    Emote {
        body: String,
    },
    File {
        body: String,
        filename: String,
        info: Option<FileInfo>,
        thumbnail_info: Option<ImageInfo>,
        thumbnail_url: Option<String>,
        url: String,
    },
    Location {
        body: String,
        geo_uri: String,
    },
    Audio {
        body: String,
        url: String,
        info: Option<AudioInfo>,
    },
    Video {
        body: String,
        url: String,
        info: Option<VideoInfo>,
    },
}
Expand description

A message sent to a room.

Variants§

§

Text

This message is the most basic message and is used to represent text.

Fields

§body: String

The body of the message.

§formatted_body: Option<String>

The formatted body of the message (if the message is formatted).

§format: Option<String>

The format of the formatted body (if the message is formatted).

§

Notice

A m.notice message should be considered similar to a plain m.text message except that clients should visually distinguish it in some way. It is intended to be used by automated clients, such as bots, bridges, and other entities, rather than humans. Additionally, such automated agents which watch a room for messages and respond to them ought to ignore m.notice messages. This helps to prevent infinite-loop situations where two automated clients continuously exchange messages, as each responds to the other.

Fields

§body: String

The notice text to send.

§formatted_body: Option<String>

The formatted body of the message (if the message is formatted).

§format: Option<String>

The format of the formatted body (if the message is formatted).

§

Image

This message represents a single image and an optional thumbnail. Information about an image and it’s thumbnail.

Fields

§body: String

A textual representation of the image. This could be the alt text of the image, the filename of the image, or some kind of content description for accessibility e.g. ‘image attachment’.

§url: String

The URL to the image.

§info: Option<ImageInfo>

Metadata about the image referred to in url.

§thumbnail_url: Option<String>

The URL to the thumbnail of the image.

§thumbnail_info: Option<ImageInfo>

Metadata about the image referred to in thumbnail_url.

§

Emote

This message is similar to m.text except that the sender is ‘performing’ the action contained in the body key, similar to /me in IRC. This message should be prefixed by the name of the sender. This message could also be represented in a different colour to distinguish it from regular m.text messages.

Fields

§body: String

The emote action to perform.

§

File

This message represents a generic file.

Fields

§body: String

A human-readable description of the file. This is recommended to be the filename of the original upload.

§filename: String

The original filename of the uploaded file.

§info: Option<FileInfo>

Information about the file referred to in url.

§thumbnail_info: Option<ImageInfo>

Metadata about the image referred to in thumbnail_url.

§thumbnail_url: Option<String>

The URL to the thumbnail of the file.

§url: String

The URL to the file.

§

Location

This message represents a real-world location.

Fields

§body: String

A description of the location e.g. ‘Big Ben, London, UK’, or some kind of content description for accessibility e.g. ‘location attachment’.

§geo_uri: String

A geo URI representing this location.

§

Audio

This message represents a single audio clip.

Fields

§body: String

A description of the audio e.g. ‘Bee Gees - Stayin’ Alive’, or some kind of content description for accessibility e.g. ‘audio attachment’.

§url: String

The URL to the audio clip.

§info: Option<AudioInfo>

Metadata for the audio clip referred to in url.

§

Video

This message represents a single video clip.

Fields

§body: String

A description of the video e.g. ‘Gangnam style’, or some kind of content description for accessibility e.g. ‘video attachment’.

§url: String

The URL to the video clip.

§info: Option<VideoInfo>

Metadata about the video clip referred to in url.

Trait Implementations§

Source§

impl Clone for Message

Source§

fn clone(&self) -> Message

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for Message

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl<'de> Deserialize<'de> for Message

Source§

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 Serialize for Message

Source§

fn serialize<__S>(&self, __serializer: __S) -> Result<__S::Ok, __S::Error>
where __S: Serializer,

Serialize this value into the given Serde serializer. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

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

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

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

Source§

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

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

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