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
use crate::types::parameters::{self, ParseMode};
use serde::Serialize;
#[derive(Debug, PartialEq, Eq, Clone, Hash, Serialize)]
#[must_use]
pub struct Text {
message_text: String,
#[serde(skip_serializing_if = "Option::is_none")]
parse_mode: Option<ParseMode>,
#[serde(skip_serializing_if = "Option::is_none")]
disable_web_page_preview: Option<bool>,
}
impl Text {
pub fn new(message_text: impl Into<parameters::Text>) -> Self {
let message_text = message_text.into();
Self {
message_text: message_text.text,
parse_mode: message_text.parse_mode,
disable_web_page_preview: None,
}
}
pub const fn is_web_page_preview_disabled(
mut self,
is_disabled: bool,
) -> Self {
self.disable_web_page_preview = Some(is_disabled);
self
}
}