mirror of
https://github.com/teloxide/teloxide.git
synced 2025-03-24 23:57:38 +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,
|
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)]
|
#[cfg(test)]
|
||||||
mod tests {
|
mod tests {
|
||||||
use super::*;
|
use super::*;
|
||||||
|
|
Loading…
Add table
Reference in a new issue