mirror of
https://github.com/teloxide/teloxide.git
synced 2024-12-23 06:51:01 +01:00
Add setters to LabeledPrice
This commit is contained in:
parent
f436cc07f5
commit
c43c5bab49
1 changed files with 22 additions and 0 deletions
|
@ -20,6 +20,28 @@ pub struct LabeledPrice {
|
|||
pub amount: i32,
|
||||
}
|
||||
|
||||
impl LabeledPrice {
|
||||
pub fn new<S>(label: S, amount: i32) -> Self
|
||||
where
|
||||
S: Into<String>,
|
||||
{
|
||||
Self { label: label.into(), amount }
|
||||
}
|
||||
|
||||
pub fn label<S>(mut self, val: S) -> Self
|
||||
where
|
||||
S: Into<String>,
|
||||
{
|
||||
self.label = val.into();
|
||||
self
|
||||
}
|
||||
|
||||
pub fn amount(mut self, val: i32) -> Self {
|
||||
self.amount = val;
|
||||
self
|
||||
}
|
||||
}
|
||||
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
use super::*;
|
||||
|
|
Loading…
Reference in a new issue