mirror of
https://github.com/teloxide/teloxide.git
synced 2025-03-24 23:57:38 +01:00
Add setters to Animation
This commit is contained in:
parent
d85b7fdab0
commit
ecae850fda
1 changed files with 80 additions and 0 deletions
|
@ -40,6 +40,86 @@ pub struct Animation {
|
||||||
pub file_size: Option<u32>,
|
pub file_size: Option<u32>,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
impl Animation {
|
||||||
|
pub fn new<S1, S2>(
|
||||||
|
file_id: S1,
|
||||||
|
file_unique_id: S2,
|
||||||
|
width: u32,
|
||||||
|
height: u32,
|
||||||
|
duration: u32,
|
||||||
|
) -> Self
|
||||||
|
where
|
||||||
|
S1: Into<String>,
|
||||||
|
S2: Into<String>,
|
||||||
|
{
|
||||||
|
Self {
|
||||||
|
file_id: file_id.into(),
|
||||||
|
file_unique_id: file_unique_id.into(),
|
||||||
|
width,
|
||||||
|
height,
|
||||||
|
duration,
|
||||||
|
thumb: None,
|
||||||
|
file_name: None,
|
||||||
|
mime_type: 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 width(mut self, val: u32) -> Self {
|
||||||
|
self.width = val;
|
||||||
|
self
|
||||||
|
}
|
||||||
|
|
||||||
|
pub fn height(mut self, val: u32) -> Self {
|
||||||
|
self.height = 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_name<S>(mut self, val: S) -> Self
|
||||||
|
where
|
||||||
|
S: Into<String>,
|
||||||
|
{
|
||||||
|
self.file_name = Some(val.into());
|
||||||
|
self
|
||||||
|
}
|
||||||
|
|
||||||
|
pub fn mime_type(mut self, val: MimeWrapper) -> Self {
|
||||||
|
self.mime_type = Some(val);
|
||||||
|
self
|
||||||
|
}
|
||||||
|
|
||||||
|
pub fn file_size(mut self, val: u32) -> Self {
|
||||||
|
self.file_size = Some(val);
|
||||||
|
self
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
#[cfg(test)]
|
#[cfg(test)]
|
||||||
mod tests {
|
mod tests {
|
||||||
use super::*;
|
use super::*;
|
||||||
|
|
Loading…
Add table
Reference in a new issue