markdown_composer/builders/
image.rs

1use crate::types::image::Image;
2
3#[derive(Clone, Debug, Default, Eq, PartialEq)]
4pub struct ImageBuilder {
5    text: String,
6    url: String,
7    footer: bool,
8}
9
10impl ImageBuilder {
11    pub fn new() -> Self {
12        Self::default()
13    }
14
15    pub fn footer(mut self, value: bool) -> Self {
16        self.footer = value;
17        self
18    }
19
20    pub fn text(mut self, text: impl Into<String>) -> Self {
21        self.text = text.into();
22        self
23    }
24
25    pub fn url(mut self, url: impl Into<String>) -> Self {
26        self.url = url.into();
27        self
28    }
29
30    pub fn build(self) -> Image {
31        Image::from(self.text, self.url, self.footer)
32    }
33}
34
35impl Image {
36    pub fn builder() -> ImageBuilder {
37        ImageBuilder::new()
38    }
39}