Add setters to Venue

This commit is contained in:
Temirkhan Myrzamadi 2020-07-28 20:35:37 +06:00
parent abaff16949
commit aa311fb96a

View file

@ -24,3 +24,51 @@ pub struct Venue {
/// `food/icecream`.)
pub foursquare_type: Option<String>,
}
impl Venue {
pub fn new<S1, S2>(location: Location, title: S1, address: S2) -> Self
where
S1: Into<String>,
S2: Into<String>,
{
Self {
location,
title: title.into(),
address: address.into(),
foursquare_id: None,
foursquare_type: None,
}
}
pub fn title<S>(mut self, val: S) -> Self
where
S: Into<String>,
{
self.title = val.into();
self
}
pub fn address<S>(mut self, val: S) -> Self
where
S: Into<String>,
{
self.address = val.into();
self
}
pub fn foursquare_id<S>(mut self, val: S) -> Self
where
S: Into<String>,
{
self.foursquare_id = Some(val.into());
self
}
pub fn foursquare_type<S>(mut self, val: S) -> Self
where
S: Into<String>,
{
self.foursquare_type = Some(val.into());
self
}
}