discord_webhook2/message/embed/
thumbnail.rs

1use serde::{Deserialize, Serialize};
2
3#[derive(Serialize, Deserialize, Debug, Clone)]
4pub struct EmbedThumbnail {
5    pub url: String,
6    #[serde(rename = "proxy_url")]
7    pub url_proxy: Option<String>,
8    pub width: Option<u16>,
9    pub height: Option<u16>,
10}
11
12impl EmbedThumbnail {
13    pub fn new() -> Self {
14        Self {
15            url: String::new(),
16            url_proxy: None,
17            width: None,
18            height: None,
19        }
20    }
21
22    pub fn url(mut self, url: impl Into<String>) -> Self {
23        self.url = url.into();
24        self
25    }
26
27    pub fn url_proxy(mut self, url_proxy: impl Into<String>) -> Self {
28        self.url_proxy = Some(url_proxy.into());
29        self
30    }
31
32    pub fn width(mut self, width: u16) -> Self {
33        self.width = Some(width);
34        self
35    }
36
37    pub fn height(mut self, height: u16) -> Self {
38        self.height = Some(height);
39        self
40    }
41}
42
43impl Default for EmbedThumbnail {
44    fn default() -> Self {
45        Self::new()
46    }
47}