osmgraphing/configs/
mod.rs

1use serde::Deserialize;
2use std::{fmt, fmt::Display};
3
4#[cfg(feature = "gpl")]
5pub mod balancing;
6#[cfg(feature = "gpl")]
7pub mod evaluating_balance;
8pub mod parsing;
9pub mod routing;
10pub mod writing;
11
12#[derive(Clone, Debug, Deserialize, Eq, PartialEq, Ord, PartialOrd)]
13#[serde(from = "String")]
14pub struct SimpleId(pub String);
15
16impl From<String> for SimpleId {
17    fn from(id: String) -> SimpleId {
18        SimpleId(id)
19    }
20}
21
22impl From<&str> for SimpleId {
23    fn from(id: &str) -> SimpleId {
24        SimpleId(id.to_owned())
25    }
26}
27
28impl Display for SimpleId {
29    fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
30        write!(f, "{}", self.0)
31    }
32}
33
34impl AsRef<str> for SimpleId {
35    fn as_ref(&self) -> &str {
36        self.0.as_ref()
37    }
38}
39
40impl AsRef<String> for SimpleId {
41    fn as_ref(&self) -> &String {
42        &self.0
43    }
44}
45
46impl AsRef<SimpleId> for SimpleId {
47    fn as_ref(&self) -> &SimpleId {
48        &self
49    }
50}