Add setters to VideoNote

This commit is contained in:
Temirkhan Myrzamadi 2020-07-28 20:41:55 +06:00
parent 7f4f77f0e6
commit 711406ba1c
2 changed files with 55 additions and 0 deletions

View file

@ -34,3 +34,56 @@ pub struct VideoNote {
/// File size. /// File size.
pub file_size: Option<u32>, pub file_size: Option<u32>,
} }
impl VideoNote {
pub fn new<S1, S2>(file_id: S1, file_unique_id: S2, length: u32, duration: u32) -> Self
where
S1: Into<String>,
S2: Into<String>,
{
Self {
file_id: file_id.into(),
file_unique_id: file_unique_id.into(),
length,
duration,
thumb: None,
file_size: None,
}
}
pub fn file_id<S>(mut self, val: S) -> Self
where
S: Into<String>,
{
self.file_id = val.into();
self
}
pub fn file_unique_id<S>(mut self, val: S) -> Self
where
S: Into<String>,
{
self.file_unique_id = val.into();
self
}
pub fn length(mut self, val: u32) -> Self {
self.length = val;
self
}
pub fn duration(mut self, val: u32) -> Self {
self.duration = val;
self
}
pub fn thumb(mut self, val: PhotoSize) -> Self {
self.thumb = Some(val);
self
}
pub fn file_size(mut self, val: u32) -> Self {
self.file_size = Some(val);
self
}
}

View file

@ -25,3 +25,5 @@ pub struct Voice {
/// File size. /// File size.
pub file_size: Option<u64>, pub file_size: Option<u64>,
} }
impl Voice {}