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
pub mod config;
pub mod watchdog;

use serde::Deserialize;

#[derive(Deserialize, Debug)]
#[serde(untagged)]
pub enum Location {
    Locale {
        region: Region,
        area: Option<String>,
    },
    Horizontal(Horizontal),
}

impl Default for Location {
    fn default() -> Self {
        Location::Locale {
            region: Region::Japan,
            area: Some("東京".to_owned()),
        }
    }
}

#[derive(Deserialize, Debug)]
pub enum Region {
    #[serde(rename = "jp")]
    Japan,
}

#[derive(Deserialize, Debug)]
pub struct Horizontal {
    pub longitude: f32,
    pub latitude: f32,
}