mirror of
https://github.com/teloxide/teloxide.git
synced 2024-12-31 16:40:37 +01:00
Add setters to OrderInfo
This commit is contained in:
parent
fd08796861
commit
b2755b96b4
1 changed files with 50 additions and 0 deletions
|
@ -20,3 +20,53 @@ pub struct OrderInfo {
|
|||
/// User's shipping address.
|
||||
pub shipping_address: ShippingAddress,
|
||||
}
|
||||
|
||||
impl OrderInfo {
|
||||
pub fn new<S1, S2, S3>(
|
||||
name: S1,
|
||||
phone_number: S2,
|
||||
email: S3,
|
||||
shipping_address: ShippingAddress,
|
||||
) -> Self
|
||||
where
|
||||
S1: Into<String>,
|
||||
S2: Into<String>,
|
||||
S3: Into<String>,
|
||||
{
|
||||
Self {
|
||||
name: name.into(),
|
||||
phone_number: phone_number.into(),
|
||||
email: email.into(),
|
||||
shipping_address,
|
||||
}
|
||||
}
|
||||
|
||||
pub fn name<S>(mut self, val: S) -> Self
|
||||
where
|
||||
S: Into<String>,
|
||||
{
|
||||
self.name = val.into();
|
||||
self
|
||||
}
|
||||
|
||||
pub fn phone_number<S>(mut self, val: S) -> Self
|
||||
where
|
||||
S: Into<String>,
|
||||
{
|
||||
self.phone_number = val.into();
|
||||
self
|
||||
}
|
||||
|
||||
pub fn email<S>(mut self, val: S) -> Self
|
||||
where
|
||||
S: Into<String>,
|
||||
{
|
||||
self.email = val.into();
|
||||
self
|
||||
}
|
||||
|
||||
pub fn shipping_address(mut self, val: ShippingAddress) -> Self {
|
||||
self.shipping_address = val;
|
||||
self
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue