#[non_exhaustive]pub struct EmbedImage {
pub url: CompactString,
pub proxy_url: Option<CompactString>,
pub height: Option<u32>,
pub width: Option<u32>,
pub content_type: Option<CompactString>,
pub placeholder: Option<CompactString>,
pub placeholder_version: Option<u32>,
pub description: Option<CompactString>,
pub flags: Option<EmbedMediaFlags>,
}Expand description
The image or thumbnail of an embed.
discord.js counterpart: EmbedAssetData.
Fields (Non-exhaustive)§
This struct is marked as non-exhaustive
Non-exhaustive structs could have additional fields added in future. Therefore, non-exhaustive structs cannot be constructed in external crates using the traditional
Struct { .. } syntax; cannot be matched against without a wildcard ..; and struct update syntax will not work.url: CompactStringThe source URL (http(s) or attachment://).
proxy_url: Option<CompactString>The URL through Discord’s media proxy.
height: Option<u32>The height in pixels.
width: Option<u32>The width in pixels.
content_type: Option<CompactString>The media type.
placeholder: Option<CompactString>A thumbhash placeholder.
placeholder_version: Option<u32>The version of the placeholder.
description: Option<CompactString>The description (alt text).
flags: Option<EmbedMediaFlags>The media flags.
Implementations§
Source§impl EmbedImage
impl EmbedImage
Sourcepub fn new(url: impl Into<CompactString>) -> Self
pub fn new(url: impl Into<CompactString>) -> Self
Creates an image or thumbnail showing url (http(s) or attachment://), with no
metadata — the metadata is filled in by Discord.
Nothing is validated; djs-builders checks the URL scheme.
discord.js counterpart: EmbedImageData.
§Examples
use djs_model::message::EmbedImage;
let image = EmbedImage::new("attachment://chart.png");
assert_eq!(image.url, "attachment://chart.png");
assert_eq!(image.width, None);Trait Implementations§
Source§impl Clone for EmbedImage
impl Clone for EmbedImage
Source§impl Debug for EmbedImage
impl Debug for EmbedImage
Source§impl<'de> Deserialize<'de> for EmbedImage
impl<'de> Deserialize<'de> for EmbedImage
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>,
Deserialize this value from the given Serde deserializer. Read more
impl Eq for EmbedImage
Source§impl Hash for EmbedImage
impl Hash for EmbedImage
Source§impl PartialEq for EmbedImage
impl PartialEq for EmbedImage
Source§impl Serialize for EmbedImage
impl Serialize for EmbedImage
impl StructuralPartialEq for EmbedImage
Auto Trait Implementations§
impl Freeze for EmbedImage
impl RefUnwindSafe for EmbedImage
impl Send for EmbedImage
impl Sync for EmbedImage
impl Unpin for EmbedImage
impl UnsafeUnpin for EmbedImage
impl UnwindSafe for EmbedImage
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
Mutably borrows from an owned value. Read more