mirror of
https://github.com/teloxide/teloxide.git
synced 2025-03-25 16:12:06 +01:00
Add setters to PhotoSize
This commit is contained in:
parent
8e9b0b2715
commit
e593d4c1c7
1 changed files with 47 additions and 0 deletions
|
@ -26,6 +26,53 @@ pub struct PhotoSize {
|
||||||
pub file_size: Option<u32>,
|
pub file_size: Option<u32>,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
impl PhotoSize {
|
||||||
|
pub fn new<S1, S2>(file_id: S1, file_unique_id: S2, width: i32, height: i32) -> Self
|
||||||
|
where
|
||||||
|
S1: Into<String>,
|
||||||
|
S2: Into<String>,
|
||||||
|
{
|
||||||
|
Self {
|
||||||
|
file_id: file_id.into(),
|
||||||
|
file_unique_id: file_unique_id.into(),
|
||||||
|
width,
|
||||||
|
height,
|
||||||
|
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: i32) -> Self {
|
||||||
|
self.width = val;
|
||||||
|
self
|
||||||
|
}
|
||||||
|
|
||||||
|
pub fn height(mut self, val: i32) -> Self {
|
||||||
|
self.height = 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