Skip to main content

MessageElement

Enum MessageElement 

Source
pub enum MessageElement {
Show 34 variants Text { text: String, }, At { id: String, name: Option<String>, role: Option<String>, at_type: Option<String>, }, Sharp { id: String, name: Option<String>, }, Image { src: String, title: Option<String>, width: Option<u32>, height: Option<u32>, cache: Option<bool>, timeout: Option<String>, }, Audio { src: String, title: Option<String>, duration: Option<u64>, poster: Option<String>, cache: Option<bool>, timeout: Option<String>, }, Video { src: String, title: Option<String>, duration: Option<u64>, poster: Option<String>, width: Option<u32>, height: Option<u32>, cache: Option<bool>, timeout: Option<String>, }, File { src: String, name: Option<String>, poster: Option<String>, cache: Option<bool>, timeout: Option<String>, }, Quote { id: String, forward: Option<bool>, children: Vec<MessageElement>, }, Author { id: String, name: Option<String>, avatar: Option<String>, }, Message { id: Option<String>, forward: Option<bool>, children: Vec<MessageElement>, }, Bold { children: Vec<MessageElement>, }, Italic { children: Vec<MessageElement>, }, Underline { children: Vec<MessageElement>, }, Strikethrough { children: Vec<MessageElement>, }, Spoiler { children: Vec<MessageElement>, }, Code { children: Vec<MessageElement>, }, Superscript { children: Vec<MessageElement>, }, Subscript { children: Vec<MessageElement>, }, LineBreak, Paragraph { children: Vec<MessageElement>, }, Link { href: String, children: Vec<MessageElement>, }, ListItem { children: Vec<MessageElement>, }, UnorderedList { children: Vec<MessageElement>, }, OrderedList { start: Option<u64>, reversed: Option<bool>, list_type: Option<String>, children: Vec<MessageElement>, }, Table { children: Vec<MessageElement>, }, TableHead { children: Vec<MessageElement>, }, TableBody { children: Vec<MessageElement>, }, TableFoot { children: Vec<MessageElement>, }, TableRow { children: Vec<MessageElement>, }, TableHeader { children: Vec<MessageElement>, }, TableCell { children: Vec<MessageElement>, }, Button { id: Option<String>, theme: Option<String>, href: Option<String>, text: Option<String>, disabled: Option<bool>, children: Vec<MessageElement>, }, Span { style: Option<String>, children: Vec<MessageElement>, }, Div { style: Option<String>, children: Vec<MessageElement>, },
}

Variants§

§

Text

文本

Fields

§text: String

消息文本

§

At

提及用户

Fields

§id: String

目标用户的 ID

§name: Option<String>

目标用户的名称

§role: Option<String>

目标角色

§at_type: Option<String>
§

Sharp

提及频道

Fields

§id: String

目标频道的 ID

§name: Option<String>

目标频道的名称

§

Image

图片

Fields

§src: String

资源的 URL

§title: Option<String>

资源的名称

§width: Option<u32>

图片宽度 (像素)

§height: Option<u32>

图片高度 (像素)

§cache: Option<bool>

是否使用已缓存的文件

§timeout: Option<String>

下载文件的最长时间 (毫秒)

§

Audio

音频

Fields

§src: String

资源的 URL

§title: Option<String>

资源的名称

§duration: Option<u64>

音频长度 (秒)

§poster: Option<String>

音频封面 URL

§cache: Option<bool>

是否使用已缓存的文件

§timeout: Option<String>

下载文件的最长时间 (毫秒)

§

Video

视频

Fields

§src: String

资源的 URL

§title: Option<String>

资源的名称

§duration: Option<u64>

视频长度 (秒)

§poster: Option<String>

视频封面 URL

§width: Option<u32>

视频宽度 (像素)

§height: Option<u32>

视频高度 (像素)

§cache: Option<bool>

是否使用已缓存的文件

§timeout: Option<String>

下载文件的最长时间 (毫秒)

§

File

文件

Fields

§src: String

资源的 URL

§name: Option<String>

资源的名称

§poster: Option<String>

缩略图封面 URL

§cache: Option<bool>

是否使用已缓存的文件

§timeout: Option<String>

下载文件的最长时间 (毫秒)

§

Quote

引用

Fields

§id: String

引用的消息ID

§forward: Option<bool>

是否为合并转发

§children: Vec<MessageElement>

子元素

§

Author

作者

Fields

§id: String

用户 ID

§name: Option<String>

昵称

§avatar: Option<String>

头像 URL

§

Message

消息

Fields

§id: Option<String>

消息的 ID

§forward: Option<bool>

是否为转发消息

§children: Vec<MessageElement>

消息的子元素

§

Bold

粗体

Fields

§

Italic

斜体

Fields

§

Underline

下划线

Fields

§

Strikethrough

删除线

Fields

§

Spoiler

剧透

Fields

§

Code

代码

Fields

§

Superscript

上标

Fields

§

Subscript

下标

Fields

§

LineBreak

换行

§

Paragraph

段落

Fields

链接

Fields

§href: String

链接的 URL

§

ListItem

Fields

§

UnorderedList

Fields

§

OrderedList

Fields

§start: Option<u64>
§reversed: Option<bool>
§list_type: Option<String>
§

Table

Fields

§

TableHead

Fields

§

TableBody

Fields

§

TableFoot

Fields

§

TableRow

Fields

§

TableHeader

Fields

§

TableCell

Fields

§

Button

Fields

§id: Option<String>

按钮的 ID

§theme: Option<String>

按钮的样式

§href: Option<String>

按钮的链接

§text: Option<String>

按钮的文本

§disabled: Option<bool>

是否禁用按钮

§

Span

Fields

§

Div

Fields

Trait Implementations§

Source§

impl Clone for MessageElement

Source§

fn clone(&self) -> MessageElement

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

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

Performs copy-assignment from source. Read more
Source§

impl Debug for MessageElement

Source§

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

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

impl<'de> Deserialize<'de> for MessageElement

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 MessageElement

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> DeserializeOwned for T
where T: for<'de> Deserialize<'de>,

Source§

impl<T> ErasedDestructor for T
where T: 'static,

Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
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> Same for T

Source§

type Output = T

Should always be Self
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<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V

Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more