Add setters to LabeledPrice

This commit is contained in:
Temirkhan Myrzamadi 2020-07-28 01:06:40 +06:00
parent f436cc07f5
commit c43c5bab49

View file

@ -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::*;