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
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
use serde::{Deserialize, Serialize};
use std::{
cmp::Ordering, fmt::{self, Display}
};
use super::AmadeusOrd;
#[derive(Clone, PartialEq, Eq, PartialOrd, Ord, Hash, Serialize, Deserialize, Debug)]
pub struct Bson(Vec<u8>);
impl Bson {
pub fn capacity(&self) -> usize {
self.0.capacity()
}
}
impl AmadeusOrd for Bson {
fn amadeus_cmp(&self, other: &Self) -> Ordering {
Ord::cmp(self, other)
}
}
impl From<Bson> for Vec<u8> {
fn from(json: Bson) -> Self {
json.0
}
}
impl From<Vec<u8>> for Bson {
fn from(string: Vec<u8>) -> Self {
Self(string)
}
}
#[derive(Clone, PartialEq, Eq, PartialOrd, Ord, Hash, Serialize, Deserialize, Debug)]
pub struct Json(String);
impl Json {
pub fn capacity(&self) -> usize {
self.0.capacity()
}
}
impl AmadeusOrd for Json {
fn amadeus_cmp(&self, other: &Self) -> Ordering {
Ord::cmp(self, other)
}
}
impl Display for Json {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
self.0.fmt(f)
}
}
impl From<Json> for String {
fn from(json: Json) -> Self {
json.0
}
}
impl From<String> for Json {
fn from(string: String) -> Self {
Self(string)
}
}
#[derive(Clone, PartialEq, Eq, PartialOrd, Ord, Hash, Serialize, Deserialize, Debug)]
pub struct Enum(String);
impl Enum {
pub fn capacity(&self) -> usize {
self.0.capacity()
}
}
impl AmadeusOrd for Enum {
fn amadeus_cmp(&self, other: &Self) -> Ordering {
Ord::cmp(self, other)
}
}
impl Display for Enum {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
self.0.fmt(f)
}
}
impl From<Enum> for String {
fn from(enum_: Enum) -> Self {
enum_.0
}
}
impl From<String> for Enum {
fn from(string: String) -> Self {
Self(string)
}
}