osm_io/osm/model/
way.rs

1use crate::osm::model::tag::Tag;
2
3#[derive(Debug, Clone)]
4pub struct Way {
5    id: i64,
6    version: i32,
7    timestamp: i64,
8    changeset: i64,
9    uid: i32,
10    user: String,
11    visible: bool,
12    refs: Vec<i64>,
13    tags: Vec<Tag>,
14}
15
16impl Way {
17    #[allow(clippy::too_many_arguments)]
18    pub fn new(id: i64, version: i32, timestamp: i64, changeset: i64, uid: i32, user: String, visible: bool, refs: Vec<i64>, tags: Vec<Tag>) -> Way {
19        Way {
20            id,
21            version,
22            timestamp,
23            changeset,
24            uid,
25            user,
26            visible,
27            refs,
28            tags,
29        }
30    }
31
32    pub fn id(&self) -> i64 {
33        self.id
34    }
35
36    pub fn version(&self) -> i32 {
37        self.version
38    }
39
40    pub fn timestamp(&self) -> i64 {
41        self.timestamp
42    }
43
44    pub fn changeset(&self) -> i64 {
45        self.changeset
46    }
47
48    pub fn uid(&self) -> i32 {
49        self.uid
50    }
51
52    pub fn user(&self) -> &String {
53        &self.user
54    }
55
56    pub fn take_user(&mut self) -> String {
57        std::mem::take(&mut self.user)
58    }
59
60    pub fn visible(&self) -> bool {
61        self.visible
62    }
63
64    pub fn refs(&self) -> &Vec<i64> {
65        &self.refs
66    }
67
68    pub fn tags(&self) -> &Vec<Tag> {
69        &self.tags
70    }
71
72    pub fn take_tags(&mut self) -> Vec<Tag> {
73        std::mem::take(&mut self.tags)
74    }
75}