rustio/
state.rs

1use restson::{Error, RestPath};
2
3#[derive(Serialize, Deserialize, Debug, Clone)]
4pub struct State {
5    pub value: String,
6    pub country: String,
7    pub stationcount: String,
8}
9
10#[derive(Serialize, Deserialize, Debug)]
11#[serde(untagged)]
12pub enum StateResponse {
13    States(Vec<State>),
14    State(State),
15}
16
17impl RestPath<()> for StateResponse {
18    fn get_path(_: ()) -> Result<String, Error> {
19        Ok(format!("webservice/json/states"))
20    }
21}