mirror of
https://github.com/teloxide/teloxide.git
synced 2025-01-09 11:43:57 +01:00
Add setters to PollAnswer
This commit is contained in:
parent
3e34cf84c8
commit
52bba75e41
1 changed files with 31 additions and 0 deletions
|
@ -15,3 +15,34 @@ pub struct PollAnswer {
|
||||||
/// May be empty if the user retracted their vote.
|
/// May be empty if the user retracted their vote.
|
||||||
pub option_ids: Vec<i32>,
|
pub option_ids: Vec<i32>,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
impl PollAnswer {
|
||||||
|
pub fn new<S, O>(poll_id: S, user: User, option_ids: O) -> Self
|
||||||
|
where
|
||||||
|
S: Into<String>,
|
||||||
|
O: Into<Vec<i32>>,
|
||||||
|
{
|
||||||
|
Self { poll_id: poll_id.into(), user, option_ids: option_ids.into() }
|
||||||
|
}
|
||||||
|
|
||||||
|
pub fn poll_id<S>(mut self, val: S) -> Self
|
||||||
|
where
|
||||||
|
S: Into<String>,
|
||||||
|
{
|
||||||
|
self.poll_id = val.into();
|
||||||
|
self
|
||||||
|
}
|
||||||
|
|
||||||
|
pub fn user(mut self, val: User) -> Self {
|
||||||
|
self.user = val;
|
||||||
|
self
|
||||||
|
}
|
||||||
|
|
||||||
|
pub fn option_ids<S>(mut self, val: S) -> Self
|
||||||
|
where
|
||||||
|
S: Into<Vec<i32>>,
|
||||||
|
{
|
||||||
|
self.option_ids = val.into();
|
||||||
|
self
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
Loading…
Reference in a new issue