twitter_stream_message/
place.rs

1//! Place
2
3use std::borrow::Cow;
4use std::collections::HashMap;
5
6use geometry::Geometry;
7
8/// Represents `place` field in `Tweet`.
9///
10/// # Reference
11///
12/// 1. [Places — Twitter Developers][1]
13///
14/// [1]: https://dev.twitter.com/overview/api/places
15#[derive(Clone, Debug, Deserialize, PartialEq)]
16pub struct Place<'a> {
17    /// Contains a hash of variant information about the place.
18    /// See [Place Attributes][1] for more detail.
19    ///
20    /// [1]: https://dev.twitter.com/overview/api/places#place_attributes
21    #[serde(borrow)]
22    #[serde(deserialize_with = "::util::deserialize_map_cow_str")]
23    pub attributes: Attributes<'a>,
24
25    /// A bounding box of coordinates which encloses this place.
26    pub bounding_box: Geometry,
27
28    /// Name of the country containing this place.
29    #[serde(borrow)]
30    pub country: Cow<'a, str>,
31
32    /// Shortened country code representing the country containing this place.
33    #[serde(borrow)]
34    pub country_code: Cow<'a, str>,
35
36    /// Full human-readable representation of the place’s name.
37    #[serde(borrow)]
38    pub full_name: Cow<'a, str>,
39
40    /// ID representing this place. Note that this is represented as a string,
41    /// not an integer.
42    #[serde(borrow)]
43    pub id: PlaceId<'a>,
44
45    /// Short human-readable representation of the place’s name.
46    #[serde(borrow)]
47    pub name: Cow<'a, str>,
48
49    /// The type of location represented by this place.
50    #[serde(borrow)]
51    pub place_type: Cow<'a, str>,
52
53    /// URL representing the location of additional place metadata
54    /// for this place.
55    #[serde(borrow)]
56    pub url: Cow<'a, str>,
57}
58
59pub type Attributes<'a> = HashMap<Cow<'a, str>, Cow<'a, str>>;
60
61/// ID of a place.
62pub type PlaceId<'a> = Cow<'a, str>;