From 7aaa7eaf646c81773d44cecf40dd8f526bc8f0c8 Mon Sep 17 00:00:00 2001 From: Temirkhan Myrzamadi Date: Tue, 28 Jul 2020 02:49:44 +0600 Subject: [PATCH] Add setters to MediaAudio --- src/types/message.rs | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) diff --git a/src/types/message.rs b/src/types/message.rs index f45023b7..45f00305 100644 --- a/src/types/message.rs +++ b/src/types/message.rs @@ -626,6 +626,36 @@ pub struct MediaAudio { pub caption_entities: Vec, } +impl MediaAudio { + pub fn new(audio: Audio, caption_entities: CE) -> Self + where + CE: Into>, + { + Self { audio, caption: None, caption_entities: caption_entities.into() } + } + + pub fn audio(mut self, val: Audio) -> Self { + self.audio = val; + self + } + + pub fn caption(mut self, val: S) -> Self + where + S: Into, + { + self.caption = Some(val.into()); + self + } + + pub fn caption_entities(mut self, val: CE) -> Self + where + CE: Into>, + { + self.caption_entities = val.into(); + self + } +} + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] #[non_exhaustive] pub struct MediaContact {