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
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
use *;
use IntoPyDict;
use GILPool;
// #[derive(Clone)]
// pub struct PyWrapperRef<'a>(pub &'a PyAny);
//
// impl PartialEq for PyWrapperRef<'_> {
// fn eq(&self, other: &Self) -> bool {
// match self.0.eq(other.0) {
// Ok(x) => x,
// _ => false,
// }
// }
// }
//
// impl PartialOrd for PyWrapperRef<'_> {
// fn partial_cmp(&self, other: &Self) -> Option<Ordering> {
// if self == other {
// Some(Equal)
// } else {
// let a = self.0;
// let b = other.0;
// match a.lt(b) {
// Ok(x) => Some(if x { Less } else { Greater }),
// _ => match a.gt(b) {
// Ok(x) => Some(if x { Greater } else { Less }),
// _ => None,
// },
// }
// }
// }
// }
//
// impl<'a> Neg for PyWrapperRef<'a> {
// type Output = Self;
//
// fn neg(self) -> Self::Output {
// let a = self.0;
// Self(
// a.call_method0("__neg__")
// .expect("There is no __neg__ method")
// )
// }
// }
;
//
// pub struct PyWrapperPool(pub PyObject, pub GILPool);
//
// impl PartialEq for PyWrapperPool {
// fn eq(&self, other: &Self) -> bool {
// let py = self.1.python();
//
// match self.0.as_ref(py).eq(other.0.as_ref(py)) {
// Ok(x) => x,
// _ => false,
// }
// }
// }
//
// impl PartialOrd for PyWrapperPool {
// fn partial_cmp(&self, other: &Self) -> Option<Ordering> {
// let py = self.1.python();
//
// if {
// match self.0.as_ref(py).eq(other.0.as_ref(py)) {
// Ok(x) => x,
// _ => false,
// }
// } {
// Some(Equal)
// } else {
// let a = self.0.as_ref(py);
// let b = other.0.as_ref(py);
// match a.lt(b) {
// Ok(x) => Some(if x { Less } else { Greater }),
// _ => match a.gt(b) {
// Ok(x) => Some(if x { Greater } else { Less }),
// _ => None,
// },
// }
// }
// }
// }
//
// impl Neg for PyWrapperPool {
// type Output = Self;
//
// fn neg(self) -> Self::Output {
// let py = self.1.python();
// let a = self.0.as_ref(py);
// Self(
// a.call_method0("__neg__")
// .expect("There is no __neg__ method")
// .into(),
// self.1,
// )
// }
// }
//
// unsafe impl Send for PyWrapperPool {}
// unsafe impl Sync for PyWrapperPool {}
//
// impl Clone for PyWrapperPool{
// fn clone(&self) -> Self {
// let py = self.1.python();
// Self(self.0.clone(),unsafe{ py.new_pool()})
// }
// }