mirror of
https://github.com/teloxide/teloxide.git
synced 2025-01-10 20:12:25 +01:00
Add setters to ShippingOption
This commit is contained in:
parent
869c32d70d
commit
69d580539b
1 changed files with 35 additions and 0 deletions
|
@ -18,6 +18,41 @@ pub struct ShippingOption {
|
||||||
pub prices: Vec<LabeledPrice>,
|
pub prices: Vec<LabeledPrice>,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
impl ShippingOption {
|
||||||
|
pub fn new<S1, S2, P>(id: S1, title: S2, prices: P) -> Self
|
||||||
|
where
|
||||||
|
S1: Into<String>,
|
||||||
|
S2: Into<String>,
|
||||||
|
P: Into<Vec<LabeledPrice>>,
|
||||||
|
{
|
||||||
|
Self { id: id.into(), title: title.into(), prices: prices.into() }
|
||||||
|
}
|
||||||
|
|
||||||
|
pub fn id<S>(mut self, val: S) -> Self
|
||||||
|
where
|
||||||
|
S: Into<String>,
|
||||||
|
{
|
||||||
|
self.id = val.into();
|
||||||
|
self
|
||||||
|
}
|
||||||
|
|
||||||
|
pub fn title<S>(mut self, val: S) -> Self
|
||||||
|
where
|
||||||
|
S: Into<String>,
|
||||||
|
{
|
||||||
|
self.title = val.into();
|
||||||
|
self
|
||||||
|
}
|
||||||
|
|
||||||
|
pub fn prices<P>(mut self, val: P) -> Self
|
||||||
|
where
|
||||||
|
P: Into<Vec<LabeledPrice>>,
|
||||||
|
{
|
||||||
|
self.prices = val.into();
|
||||||
|
self
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
#[cfg(test)]
|
#[cfg(test)]
|
||||||
mod tests {
|
mod tests {
|
||||||
use super::*;
|
use super::*;
|
||||||
|
|
Loading…
Reference in a new issue