1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
use serde::Serialize;
#[derive(Debug, PartialEq, Clone, Copy, Serialize)]
#[must_use]
pub struct Venue<'a> {
latitude: f64,
longitude: f64,
title: &'a str,
address: &'a str,
#[serde(skip_serializing_if = "Option::is_none")]
foursquare_id: Option<&'a str>,
#[serde(skip_serializing_if = "Option::is_none")]
foursquare_type: Option<&'a str>,
}
impl<'a> Venue<'a> {
pub const fn new(
(latitude, longitude): (f64, f64),
title: &'a str,
address: &'a str,
) -> Self {
Self {
latitude,
longitude,
title,
address,
foursquare_id: None,
foursquare_type: None,
}
}
pub fn foursquare_id(mut self, id: &'a str) -> Self {
self.foursquare_id = Some(id);
self
}
pub fn foursquare_type(mut self, foursquare_type: &'a str) -> Self {
self.foursquare_type = Some(foursquare_type);
self
}
}