mirror of
https://github.com/teloxide/teloxide.git
synced 2025-03-14 11:44:04 +01:00
Add setters to UserProfilePhotos
This commit is contained in:
parent
8cd9d582aa
commit
abaff16949
1 changed files with 24 additions and 0 deletions
|
@ -14,3 +14,27 @@ pub struct UserProfilePhotos {
|
|||
/// Requested profile pictures (in up to 4 sizes each).
|
||||
pub photos: Vec<Vec<PhotoSize>>,
|
||||
}
|
||||
|
||||
impl UserProfilePhotos {
|
||||
pub fn new<P1, P2>(total_count: u32, photos: P1) -> Self
|
||||
where
|
||||
P1: Into<Vec<P2>>,
|
||||
P2: Into<Vec<PhotoSize>>,
|
||||
{
|
||||
Self { total_count, photos: photos.into().into_iter().map(Into::into).collect() }
|
||||
}
|
||||
|
||||
pub fn total_count(mut self, val: u32) -> Self {
|
||||
self.total_count = val;
|
||||
self
|
||||
}
|
||||
|
||||
pub fn photos<P1, P2>(mut self, val: P1) -> Self
|
||||
where
|
||||
P1: Into<Vec<P2>>,
|
||||
P2: Into<Vec<PhotoSize>>,
|
||||
{
|
||||
self.photos = val.into().into_iter().map(Into::into).collect();
|
||||
self
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue