Skip to main content

Embed

Struct Embed 

Source
pub struct Embed {
    pub title: Option<String>,
    pub description: Option<String>,
    pub url: Option<String>,
    pub color: Option<u32>,
    pub timestamp: Option<u64>,
    pub author: Option<EmbedAuthor>,
    pub footer: Option<EmbedFooter>,
    pub image: Option<AttachmentId>,
    pub thumbnail: Option<AttachmentId>,
    pub fields: Vec<EmbedField>,
}
Expand description

An embed (§8.5). Every text is optional, but an embed shows something: a title, a description, an author, a footer, a picture or a field (color, timestamp and url alone do not count).

Fields§

§title: Option<String>

1–256 scalars.

§description: Option<String>

1–4 096 scalars.

§url: Option<String>

The title’s link: https:// only, ≤ 2 048 bytes, no whitespace or control characters. Needs a title.

§color: Option<u32>

0x000000–0xFFFFFF.

§timestamp: Option<u64>

A time the embed shows, ms since the epoch (< 2^53).

§author: Option<EmbedAuthor>

The author line.

§footer: Option<EmbedFooter>

The footer line.

§image: Option<AttachmentId>

The large picture: one of the message’s attachments.

§thumbnail: Option<AttachmentId>

The small picture: one of the message’s attachments.

§fields: Vec<EmbedField>

Up to 25 fields, in order.

Implementations§

Source§

impl Embed

Source

pub fn attachments( &self, ) -> impl Iterator<Item = (&'static str, AttachmentId)> + '_

The attachments this embed shows, with the field that names each: embeds.image, embeds.thumbnail, embeds.author.icon, embeds.footer.icon.

Source

pub fn is_empty(&self) -> bool

Whether the embed shows nothing but a colour, a time or a bare link.

Trait Implementations§

Source§

impl Clone for Embed

Source§

fn clone(&self) -> Embed

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 Embed

Source§

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

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

impl Default for Embed

Source§

fn default() -> Embed

Returns the “default value” for a type. Read more
Source§

impl<'de> Deserialize<'de> for Embed

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 Eq for Embed

Source§

impl PartialEq for Embed

Source§

fn eq(&self, other: &Embed) -> bool

Equality operator ==. Read more
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Inequality operator !=. Read more
Source§

impl Serialize for Embed

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
Source§

impl StructuralPartialEq for Embed

Auto Trait Implementations§

§

impl Freeze for Embed

§

impl RefUnwindSafe for Embed

§

impl Send for Embed

§

impl Sync for Embed

§

impl Unpin for Embed

§

impl UnsafeUnpin for Embed

§

impl UnwindSafe for Embed

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> 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> 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.