Add setters to StickerSet

This commit is contained in:
Temirkhan Myrzamadi 2020-07-28 20:11:06 +06:00
parent f4a87b0d70
commit 9b3ce4b0bb

View file

@ -25,3 +25,61 @@ pub struct StickerSet {
/// List of all set stickers.
pub stickers: Vec<Sticker>,
}
impl StickerSet {
pub fn new<S1, S2, St>(
name: S1,
title: S2,
is_animated: bool,
contains_masks: bool,
stickers: St,
) -> Self
where
S1: Into<String>,
S2: Into<String>,
St: Into<Vec<Sticker>>,
{
Self {
name: name.into(),
title: title.into(),
is_animated,
contains_masks,
stickers: stickers.into(),
}
}
pub fn name<S>(mut self, val: S) -> Self
where
S: Into<String>,
{
self.name = val.into();
self
}
pub fn title<S>(mut self, val: S) -> Self
where
S: Into<String>,
{
self.title = val.into();
self
}
#[allow(clippy::wrong_self_convention)]
pub fn is_animated(mut self, val: bool) -> Self {
self.is_animated = val;
self
}
pub fn contains_masks(mut self, val: bool) -> Self {
self.contains_masks = val;
self
}
pub fn stickers<S>(mut self, val: S) -> Self
where
S: Into<Vec<Sticker>>,
{
self.stickers = val.into();
self
}
}