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
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
#![deny(missing_docs)]
extern crate iron;
extern crate reep;
#[cfg(feature = "rustc-serialize-support")]
extern crate rustc_serialize;
#[cfg(feature = "serde-support")]
extern crate serde;
use iron::typemap::Key;
use iron::IronResult;
use reep::types::{ParsableId, Id};
#[cfg(feature = "rustc-serialize-support")]
pub use rustc_serialize_support::*;
#[cfg(feature = "serde-support")]
pub use serde_support::*;
#[cfg(feature = "rustc-serialize-support")]
mod rustc_serialize_support;
#[cfg(feature = "serde-support")]
mod serde_support;
#[derive(Clone, Debug, PartialEq, Eq, Hash)]
pub struct DefaultId(String);
impl DefaultId {
pub fn new(s: String) -> DefaultId {
DefaultId(s)
}
}
impl Into<String> for DefaultId {
fn into(self) -> String {
self.0
}
}
impl ParsableId for DefaultId {
fn parse(s: &str) -> IronResult<DefaultId> {
Ok(DefaultId(s.into()))
}
}
impl Key for DefaultId {
type Value = Self;
}
impl Id for DefaultId {}