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