rloop 0.1.0a5__tar.gz → 0.1.2__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (38) hide show
  1. {rloop-0.1.0a5 → rloop-0.1.2}/Cargo.lock +70 -118
  2. {rloop-0.1.0a5 → rloop-0.1.2}/Cargo.toml +5 -5
  3. {rloop-0.1.0a5 → rloop-0.1.2}/PKG-INFO +11 -12
  4. {rloop-0.1.0a5 → rloop-0.1.2}/README.md +7 -8
  5. {rloop-0.1.0a5 → rloop-0.1.2}/rloop/_rloop.pyi +1 -0
  6. {rloop-0.1.0a5 → rloop-0.1.2}/rloop/loop.py +25 -5
  7. rloop-0.1.2/src/event_loop.rs +1189 -0
  8. rloop-0.1.2/src/handles.rs +206 -0
  9. rloop-0.1.2/src/tcp.rs +720 -0
  10. {rloop-0.1.0a5 → rloop-0.1.2}/src/time.rs +2 -2
  11. rloop-0.1.2/src/utils.rs +27 -0
  12. {rloop-0.1.0a5 → rloop-0.1.2}/tests/tcp/test_tcp_conn.py +5 -0
  13. {rloop-0.1.0a5 → rloop-0.1.2}/tests/tcp/test_tcp_server.py +3 -0
  14. rloop-0.1.0a5/src/event_loop.rs +0 -1087
  15. rloop-0.1.0a5/src/handles.rs +0 -207
  16. rloop-0.1.0a5/src/tcp.rs +0 -786
  17. rloop-0.1.0a5/src/utils.rs +0 -12
  18. {rloop-0.1.0a5 → rloop-0.1.2}/LICENSE +0 -0
  19. {rloop-0.1.0a5 → rloop-0.1.2}/pyproject.toml +0 -0
  20. {rloop-0.1.0a5 → rloop-0.1.2}/rloop/__init__.py +0 -0
  21. {rloop-0.1.0a5 → rloop-0.1.2}/rloop/_compat.py +0 -0
  22. {rloop-0.1.0a5 → rloop-0.1.2}/rloop/exc.py +0 -0
  23. {rloop-0.1.0a5 → rloop-0.1.2}/rloop/futures.py +0 -0
  24. {rloop-0.1.0a5 → rloop-0.1.2}/rloop/server.py +0 -0
  25. {rloop-0.1.0a5 → rloop-0.1.2}/rloop/subprocess.py +0 -0
  26. {rloop-0.1.0a5 → rloop-0.1.2}/rloop/transports.py +0 -0
  27. {rloop-0.1.0a5 → rloop-0.1.2}/rloop/utils.py +0 -0
  28. {rloop-0.1.0a5 → rloop-0.1.2}/src/io.rs +0 -0
  29. {rloop-0.1.0a5 → rloop-0.1.2}/src/lib.rs +0 -0
  30. {rloop-0.1.0a5 → rloop-0.1.2}/src/log.rs +0 -0
  31. {rloop-0.1.0a5 → rloop-0.1.2}/src/py.rs +0 -0
  32. {rloop-0.1.0a5 → rloop-0.1.2}/src/server.rs +0 -0
  33. {rloop-0.1.0a5 → rloop-0.1.2}/src/sock.rs +0 -0
  34. {rloop-0.1.0a5 → rloop-0.1.2}/tests/conftest.py +0 -0
  35. {rloop-0.1.0a5 → rloop-0.1.2}/tests/tcp/__init__.py +0 -0
  36. {rloop-0.1.0a5/tests/handles → rloop-0.1.2/tests}/test_handles.py +0 -0
  37. {rloop-0.1.0a5 → rloop-0.1.2}/tests/test_sockets.py +0 -0
  38. {rloop-0.1.0a5 → rloop-0.1.2}/tests/udp/test_udp.py +0 -0
@@ -4,9 +4,9 @@ version = 4
4
4
 
5
5
  [[package]]
6
6
  name = "anyhow"
7
- version = "1.0.95"
7
+ version = "1.0.98"
8
8
  source = "registry+https://github.com/rust-lang/crates.io-index"
9
- checksum = "34ac096ce696dc2fcabef30516bb13c0a68a11d30131d3df6f04711467681b04"
9
+ checksum = "e16d2d3311acee920a9eb8d33b8cbc1787ce4a264e85f964c2404b969bdcd487"
10
10
 
11
11
  [[package]]
12
12
  name = "autocfg"
@@ -14,52 +14,20 @@ version = "1.4.0"
14
14
  source = "registry+https://github.com/rust-lang/crates.io-index"
15
15
  checksum = "ace50bade8e6234aa140d9a2f552bbee1db4d353f69b8217bc503490fc1a9f26"
16
16
 
17
- [[package]]
18
- name = "bitflags"
19
- version = "2.8.0"
20
- source = "registry+https://github.com/rust-lang/crates.io-index"
21
- checksum = "8f68f53c83ab957f72c32642f3868eec03eb974d1fb82e453128456482613d36"
22
-
23
17
  [[package]]
24
18
  name = "cc"
25
- version = "1.2.10"
19
+ version = "1.2.24"
26
20
  source = "registry+https://github.com/rust-lang/crates.io-index"
27
- checksum = "13208fcbb66eaeffe09b99fffbe1af420f00a7b35aa99ad683dfc1aa76145229"
21
+ checksum = "16595d3be041c03b09d08d0858631facccee9221e579704070e6e9e4915d3bc7"
28
22
  dependencies = [
29
23
  "shlex",
30
24
  ]
31
25
 
32
26
  [[package]]
33
- name = "cfg-if"
34
- version = "1.0.0"
35
- source = "registry+https://github.com/rust-lang/crates.io-index"
36
- checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd"
37
-
38
- [[package]]
39
- name = "crossbeam-utils"
40
- version = "0.8.21"
41
- source = "registry+https://github.com/rust-lang/crates.io-index"
42
- checksum = "d0a5c400df2834b80a4c3327b3aad3a4c4cd4de0629063962b03235697506a28"
43
-
44
- [[package]]
45
- name = "dashmap"
46
- version = "6.1.0"
47
- source = "registry+https://github.com/rust-lang/crates.io-index"
48
- checksum = "5041cc499144891f3790297212f32a74fb938e5136a14943f338ef9e0ae276cf"
49
- dependencies = [
50
- "cfg-if",
51
- "crossbeam-utils",
52
- "hashbrown",
53
- "lock_api",
54
- "once_cell",
55
- "parking_lot_core",
56
- ]
57
-
58
- [[package]]
59
- name = "hashbrown"
60
- version = "0.14.5"
27
+ name = "equivalent"
28
+ version = "1.0.2"
61
29
  source = "registry+https://github.com/rust-lang/crates.io-index"
62
- checksum = "e5274423e17b7c9fc20b6e7e208532f9b19825d82dfd615708b70edd83df41f1"
30
+ checksum = "877a4ace8713b0bcf2a4e7eec82529c029f1d0619886d18145fea96c3ffe5c0f"
63
31
 
64
32
  [[package]]
65
33
  name = "heck"
@@ -69,31 +37,21 @@ checksum = "2304e00983f87ffb38b55b444b5e3b60a884b5d30c0fca7d82fe33449bbe55ea"
69
37
 
70
38
  [[package]]
71
39
  name = "indoc"
72
- version = "2.0.5"
40
+ version = "2.0.6"
73
41
  source = "registry+https://github.com/rust-lang/crates.io-index"
74
- checksum = "b248f5224d1d606005e02c97f5aa4e88eeb230488bcc03bc9ca4d7991399f2b5"
42
+ checksum = "f4c7245a08504955605670dbf141fceab975f15ca21570696aebe9d2e71576bd"
75
43
 
76
44
  [[package]]
77
45
  name = "libc"
78
- version = "0.2.169"
46
+ version = "0.2.172"
79
47
  source = "registry+https://github.com/rust-lang/crates.io-index"
80
- checksum = "b5aba8db14291edd000dfcc4d620c7ebfb122c613afb886ca8803fa4e128a20a"
81
-
82
- [[package]]
83
- name = "lock_api"
84
- version = "0.4.12"
85
- source = "registry+https://github.com/rust-lang/crates.io-index"
86
- checksum = "07af8b9cdd281b7915f413fa73f29ebd5d55d0d3f0155584dade1ff18cea1b17"
87
- dependencies = [
88
- "autocfg",
89
- "scopeguard",
90
- ]
48
+ checksum = "d750af042f7ef4f724306de029d18836c26c1765a54a6a3f094cbd23a7267ffa"
91
49
 
92
50
  [[package]]
93
51
  name = "log"
94
- version = "0.4.25"
52
+ version = "0.4.27"
95
53
  source = "registry+https://github.com/rust-lang/crates.io-index"
96
- checksum = "04cbf5b083de1c7e0222a7a51dbfdba1cbe1c6ab0b15e29fff3f6c077fd9cd9f"
54
+ checksum = "13dc2df351e3202783a1fe0d44375f7295ffb4049267b0f3018346dc122a1d94"
97
55
 
98
56
  [[package]]
99
57
  name = "memoffset"
@@ -106,58 +64,54 @@ dependencies = [
106
64
 
107
65
  [[package]]
108
66
  name = "mio"
109
- version = "1.0.3"
67
+ version = "1.0.4"
110
68
  source = "registry+https://github.com/rust-lang/crates.io-index"
111
- checksum = "2886843bf800fba2e3377cff24abf6379b4c4d5c6681eaf9ea5b0d15090450bd"
69
+ checksum = "78bed444cc8a2160f01cbcf811ef18cac863ad68ae8ca62092e8db51d51c761c"
112
70
  dependencies = [
113
71
  "libc",
114
72
  "log",
115
73
  "wasi",
116
- "windows-sys",
74
+ "windows-sys 0.59.0",
117
75
  ]
118
76
 
119
77
  [[package]]
120
78
  name = "once_cell"
121
- version = "1.20.2"
79
+ version = "1.21.3"
122
80
  source = "registry+https://github.com/rust-lang/crates.io-index"
123
- checksum = "1261fe7e33c73b354eab43b1273a57c8f967d0391e80353e51f764ac02cf6775"
81
+ checksum = "42f5e15c9953c5e4ccceeb2e7382a716482c34515315f7b03532b8b4e8393d2d"
124
82
 
125
83
  [[package]]
126
- name = "parking_lot_core"
127
- version = "0.9.10"
84
+ name = "papaya"
85
+ version = "0.2.1"
128
86
  source = "registry+https://github.com/rust-lang/crates.io-index"
129
- checksum = "1e401f977ab385c9e4e3ab30627d6f26d00e2c73eef317493c4ec6d468726cf8"
87
+ checksum = "6827e3fc394523c21d4464d02c0bb1c19966ea4a58a9844ad6d746214179d2bc"
130
88
  dependencies = [
131
- "cfg-if",
132
- "libc",
133
- "redox_syscall",
134
- "smallvec",
135
- "windows-targets",
89
+ "equivalent",
90
+ "seize",
136
91
  ]
137
92
 
138
93
  [[package]]
139
94
  name = "portable-atomic"
140
- version = "1.10.0"
95
+ version = "1.11.0"
141
96
  source = "registry+https://github.com/rust-lang/crates.io-index"
142
- checksum = "280dc24453071f1b63954171985a0b0d30058d287960968b9b2aca264c8d4ee6"
97
+ checksum = "350e9b48cbc6b0e028b0473b114454c6316e57336ee184ceab6e53f72c178b3e"
143
98
 
144
99
  [[package]]
145
100
  name = "proc-macro2"
146
- version = "1.0.93"
101
+ version = "1.0.95"
147
102
  source = "registry+https://github.com/rust-lang/crates.io-index"
148
- checksum = "60946a68e5f9d28b0dc1c21bb8a97ee7d018a8b322fa57838ba31cc878e22d99"
103
+ checksum = "02b3e5e68a3a1a02aad3ec490a98007cbc13c37cbe84a3cd7b8e406d76e7f778"
149
104
  dependencies = [
150
105
  "unicode-ident",
151
106
  ]
152
107
 
153
108
  [[package]]
154
109
  name = "pyo3"
155
- version = "0.23.4"
110
+ version = "0.25.0"
156
111
  source = "registry+https://github.com/rust-lang/crates.io-index"
157
- checksum = "57fe09249128b3173d092de9523eaa75136bf7ba85e0d69eca241c7939c933cc"
112
+ checksum = "f239d656363bcee73afef85277f1b281e8ac6212a1d42aa90e55b90ed43c47a4"
158
113
  dependencies = [
159
114
  "anyhow",
160
- "cfg-if",
161
115
  "indoc",
162
116
  "libc",
163
117
  "memoffset",
@@ -171,9 +125,9 @@ dependencies = [
171
125
 
172
126
  [[package]]
173
127
  name = "pyo3-build-config"
174
- version = "0.23.4"
128
+ version = "0.25.0"
175
129
  source = "registry+https://github.com/rust-lang/crates.io-index"
176
- checksum = "1cd3927b5a78757a0d71aa9dff669f903b1eb64b54142a9bd9f757f8fde65fd7"
130
+ checksum = "755ea671a1c34044fa165247aaf6f419ca39caa6003aee791a0df2713d8f1b6d"
177
131
  dependencies = [
178
132
  "once_cell",
179
133
  "python3-dll-a",
@@ -182,9 +136,9 @@ dependencies = [
182
136
 
183
137
  [[package]]
184
138
  name = "pyo3-ffi"
185
- version = "0.23.4"
139
+ version = "0.25.0"
186
140
  source = "registry+https://github.com/rust-lang/crates.io-index"
187
- checksum = "dab6bb2102bd8f991e7749f130a70d05dd557613e39ed2deeee8e9ca0c4d548d"
141
+ checksum = "fc95a2e67091e44791d4ea300ff744be5293f394f1bafd9f78c080814d35956e"
188
142
  dependencies = [
189
143
  "libc",
190
144
  "pyo3-build-config",
@@ -192,9 +146,9 @@ dependencies = [
192
146
 
193
147
  [[package]]
194
148
  name = "pyo3-macros"
195
- version = "0.23.4"
149
+ version = "0.25.0"
196
150
  source = "registry+https://github.com/rust-lang/crates.io-index"
197
- checksum = "91871864b353fd5ffcb3f91f2f703a22a9797c91b9ab497b1acac7b07ae509c7"
151
+ checksum = "a179641d1b93920829a62f15e87c0ed791b6c8db2271ba0fd7c2686090510214"
198
152
  dependencies = [
199
153
  "proc-macro2",
200
154
  "pyo3-macros-backend",
@@ -204,9 +158,9 @@ dependencies = [
204
158
 
205
159
  [[package]]
206
160
  name = "pyo3-macros-backend"
207
- version = "0.23.4"
161
+ version = "0.25.0"
208
162
  source = "registry+https://github.com/rust-lang/crates.io-index"
209
- checksum = "43abc3b80bc20f3facd86cd3c60beed58c3e2aa26213f3cda368de39c60a27e4"
163
+ checksum = "9dff85ebcaab8c441b0e3f7ae40a6963ecea8a9f5e74f647e33fcf5ec9a1e89e"
210
164
  dependencies = [
211
165
  "heck",
212
166
  "proc-macro2",
@@ -217,49 +171,44 @@ dependencies = [
217
171
 
218
172
  [[package]]
219
173
  name = "python3-dll-a"
220
- version = "0.2.12"
174
+ version = "0.2.14"
221
175
  source = "registry+https://github.com/rust-lang/crates.io-index"
222
- checksum = "9b66f9171950e674e64bad3456e11bb3cca108e5c34844383cfe277f45c8a7a8"
176
+ checksum = "d381ef313ae70b4da5f95f8a4de773c6aa5cd28f73adec4b4a31df70b66780d8"
223
177
  dependencies = [
224
178
  "cc",
225
179
  ]
226
180
 
227
181
  [[package]]
228
182
  name = "quote"
229
- version = "1.0.38"
183
+ version = "1.0.40"
230
184
  source = "registry+https://github.com/rust-lang/crates.io-index"
231
- checksum = "0e4dccaaaf89514f546c693ddc140f729f958c247918a13380cccc6078391acc"
185
+ checksum = "1885c039570dc00dcb4ff087a89e185fd56bae234ddc7f056a945bf36467248d"
232
186
  dependencies = [
233
187
  "proc-macro2",
234
188
  ]
235
189
 
236
- [[package]]
237
- name = "redox_syscall"
238
- version = "0.5.8"
239
- source = "registry+https://github.com/rust-lang/crates.io-index"
240
- checksum = "03a862b389f93e68874fbf580b9de08dd02facb9a788ebadaf4a3fd33cf58834"
241
- dependencies = [
242
- "bitflags",
243
- ]
244
-
245
190
  [[package]]
246
191
  name = "rloop"
247
- version = "0.1.0-alpha5"
192
+ version = "0.1.2"
248
193
  dependencies = [
249
194
  "anyhow",
250
- "dashmap",
251
195
  "libc",
252
196
  "mio",
197
+ "papaya",
253
198
  "pyo3",
254
199
  "pyo3-build-config",
255
200
  "socket2",
256
201
  ]
257
202
 
258
203
  [[package]]
259
- name = "scopeguard"
260
- version = "1.2.0"
204
+ name = "seize"
205
+ version = "0.5.0"
261
206
  source = "registry+https://github.com/rust-lang/crates.io-index"
262
- checksum = "94143f37725109f92c262ed2cf5e59bce7498c01bcc1502d7b9afe439a4e9f49"
207
+ checksum = "e4b8d813387d566f627f3ea1b914c068aac94c40ae27ec43f5f33bde65abefe7"
208
+ dependencies = [
209
+ "libc",
210
+ "windows-sys 0.52.0",
211
+ ]
263
212
 
264
213
  [[package]]
265
214
  name = "shlex"
@@ -267,27 +216,21 @@ version = "1.3.0"
267
216
  source = "registry+https://github.com/rust-lang/crates.io-index"
268
217
  checksum = "0fda2ff0d084019ba4d7c6f371c95d8fd75ce3524c3cb8fb653a3023f6323e64"
269
218
 
270
- [[package]]
271
- name = "smallvec"
272
- version = "1.13.2"
273
- source = "registry+https://github.com/rust-lang/crates.io-index"
274
- checksum = "3c5e1a9a646d36c3599cd173a41282daf47c44583ad367b8e6837255952e5c67"
275
-
276
219
  [[package]]
277
220
  name = "socket2"
278
- version = "0.5.8"
221
+ version = "0.5.10"
279
222
  source = "registry+https://github.com/rust-lang/crates.io-index"
280
- checksum = "c970269d99b64e60ec3bd6ad27270092a5394c4e309314b18ae3fe575695fbe8"
223
+ checksum = "e22376abed350d73dd1cd119b57ffccad95b4e585a7cda43e286245ce23c0678"
281
224
  dependencies = [
282
225
  "libc",
283
- "windows-sys",
226
+ "windows-sys 0.52.0",
284
227
  ]
285
228
 
286
229
  [[package]]
287
230
  name = "syn"
288
- version = "2.0.96"
231
+ version = "2.0.101"
289
232
  source = "registry+https://github.com/rust-lang/crates.io-index"
290
- checksum = "d5d0adab1ae378d7f53bdebc67a39f1f151407ef230f0ce2883572f5d8985c80"
233
+ checksum = "8ce2b7fc941b3a24138a0a7cf8e858bfc6a992e7978a068a5c760deb0ed43caf"
291
234
  dependencies = [
292
235
  "proc-macro2",
293
236
  "quote",
@@ -296,21 +239,21 @@ dependencies = [
296
239
 
297
240
  [[package]]
298
241
  name = "target-lexicon"
299
- version = "0.12.16"
242
+ version = "0.13.2"
300
243
  source = "registry+https://github.com/rust-lang/crates.io-index"
301
- checksum = "61c41af27dd6d1e27b1b16b489db798443478cef1f06a660c96db617ba5de3b1"
244
+ checksum = "e502f78cdbb8ba4718f566c418c52bc729126ffd16baee5baa718cf25dd5a69a"
302
245
 
303
246
  [[package]]
304
247
  name = "unicode-ident"
305
- version = "1.0.15"
248
+ version = "1.0.18"
306
249
  source = "registry+https://github.com/rust-lang/crates.io-index"
307
- checksum = "11cd88e12b17c6494200a9c1b683a04fcac9573ed74cd1b62aeb2727c5592243"
250
+ checksum = "5a5f39404a5da50712a4c1eecf25e90dd62b613502b7e925fd4e4d19b5c96512"
308
251
 
309
252
  [[package]]
310
253
  name = "unindent"
311
- version = "0.2.3"
254
+ version = "0.2.4"
312
255
  source = "registry+https://github.com/rust-lang/crates.io-index"
313
- checksum = "c7de7d73e1754487cb58364ee906a499937a0dfabd86bcb980fa99ec8c8fa2ce"
256
+ checksum = "7264e107f553ccae879d21fbea1d6724ac785e8c3bfc762137959b5802826ef3"
314
257
 
315
258
  [[package]]
316
259
  name = "wasi"
@@ -327,6 +270,15 @@ dependencies = [
327
270
  "windows-targets",
328
271
  ]
329
272
 
273
+ [[package]]
274
+ name = "windows-sys"
275
+ version = "0.59.0"
276
+ source = "registry+https://github.com/rust-lang/crates.io-index"
277
+ checksum = "1e38bc4d79ed67fd075bcc251a1c39b32a1776bbe92e5bef1f0bf1f8c531853b"
278
+ dependencies = [
279
+ "windows-targets",
280
+ ]
281
+
330
282
  [[package]]
331
283
  name = "windows-targets"
332
284
  version = "0.52.6"
@@ -1,6 +1,6 @@
1
1
  [package]
2
2
  name = "rloop"
3
- version = "0.1.0-alpha5"
3
+ version = "0.1.2"
4
4
  description = "An asyncio event loop implemented in Rust"
5
5
  authors = ["Giovanni Barillari <g@baro.dev>"]
6
6
  license = "BSD-3-Clause"
@@ -31,16 +31,16 @@ crate-type = ["cdylib"]
31
31
 
32
32
  [dependencies]
33
33
  anyhow = "=1.0"
34
- dashmap = { version = "=6.1", features = ["inline"] }
35
34
  mio = { version = "=1.0", features = ["net", "os-ext", "os-poll"] }
36
- pyo3 = { version = "=0.23", features = ["anyhow", "extension-module", "generate-import-lib"] }
37
- socket2 = "=0.5"
35
+ papaya = "=0.2"
36
+ pyo3 = { version = "=0.25", features = ["anyhow", "extension-module", "generate-import-lib"] }
37
+ socket2 = { version = "=0.5", features = ["all"] }
38
38
 
39
39
  [target.'cfg(unix)'.dependencies]
40
40
  libc = "0.2.159"
41
41
 
42
42
  [build-dependencies]
43
- pyo3-build-config = "=0.23"
43
+ pyo3-build-config = "=0.25"
44
44
 
45
45
  [profile.release]
46
46
  codegen-units = 1
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: rloop
3
- Version: 0.1.0a5
3
+ Version: 0.1.2
4
4
  Classifier: Development Status :: 3 - Alpha
5
5
  Classifier: Intended Audience :: Developers
6
6
  Classifier: License :: OSI Approved :: BSD License
@@ -16,9 +16,9 @@ Classifier: Programming Language :: Python :: Implementation :: CPython
16
16
  Classifier: Programming Language :: Python :: Implementation :: PyPy
17
17
  Classifier: Programming Language :: Python
18
18
  Classifier: Programming Language :: Rust
19
- Requires-Dist: ruff ~=0.5.0 ; extra == 'lint'
20
- Requires-Dist: pytest ~=7.4.2 ; extra == 'test'
21
- Requires-Dist: pytest-asyncio ~=0.21.1 ; extra == 'test'
19
+ Requires-Dist: ruff~=0.5.0 ; extra == 'lint'
20
+ Requires-Dist: pytest~=7.4.2 ; extra == 'test'
21
+ Requires-Dist: pytest-asyncio~=0.21.1 ; extra == 'test'
22
22
  Requires-Dist: rloop[lint,test] ; extra == 'dev'
23
23
  Provides-Extra: lint
24
24
  Provides-Extra: test
@@ -38,10 +38,11 @@ Project-URL: Source, https://github.com/gi0baro/rloop
38
38
 
39
39
  # RLoop
40
40
 
41
- RLoop is an [AsyncIO](https://docs.python.org/3/library/asyncio.html) event loop implemented in Rust on top of the [mio crate](https://github.com/tokio-rs/mio).
41
+ RLoop is an [AsyncIO](https://docs.python.org/3/library/asyncio.html) selector event loop implemented in Rust on top of the [mio crate](https://github.com/tokio-rs/mio).
42
42
 
43
- > [!WARNING]
44
- > Disclaimer: This is a work in progress and definitely not ready for production usage.
43
+ > **Warning**: RLoop is currently a work in progress and definitely not suited for *production usage*.
44
+
45
+ > **Note:** RLoop is available on Unix systems only.
45
46
 
46
47
  ## Installation
47
48
 
@@ -62,10 +63,10 @@ asyncio.set_event_loop(loop)
62
63
 
63
64
  ## Differences from stdlib
64
65
 
65
- At current time, in comparison with the stdlib's event loop, RLoop doesn't support the following features:
66
+ At current time, when compared with the stdlib's event loop, RLoop doesn't support the following features:
66
67
 
67
68
  - UDP
68
- - Unix domain sockets
69
+ - Unix Domain Sockets
69
70
  - SSL
70
71
  - debugging
71
72
 
@@ -78,9 +79,7 @@ RLoop also doesn't implement the following methods:
78
79
  - `loop.sock_sendto`
79
80
  - `loop.sock_sendfile`
80
81
 
81
- ### Differences in behaviour
82
-
83
- #### `call_later` with negative delays
82
+ ### `call_later` with negative delays
84
83
 
85
84
  While the stdlib's event loop will use the actual delay of callbacks when `call_later` is used with negative numbers, RLoop will treat those as `call_soon`, and thus the effective order will follow the invocation order, not the delay.
86
85
 
@@ -1,9 +1,10 @@
1
1
  # RLoop
2
2
 
3
- RLoop is an [AsyncIO](https://docs.python.org/3/library/asyncio.html) event loop implemented in Rust on top of the [mio crate](https://github.com/tokio-rs/mio).
3
+ RLoop is an [AsyncIO](https://docs.python.org/3/library/asyncio.html) selector event loop implemented in Rust on top of the [mio crate](https://github.com/tokio-rs/mio).
4
4
 
5
- > [!WARNING]
6
- > Disclaimer: This is a work in progress and definitely not ready for production usage.
5
+ > **Warning**: RLoop is currently a work in progress and definitely not suited for *production usage*.
6
+
7
+ > **Note:** RLoop is available on Unix systems only.
7
8
 
8
9
  ## Installation
9
10
 
@@ -24,10 +25,10 @@ asyncio.set_event_loop(loop)
24
25
 
25
26
  ## Differences from stdlib
26
27
 
27
- At current time, in comparison with the stdlib's event loop, RLoop doesn't support the following features:
28
+ At current time, when compared with the stdlib's event loop, RLoop doesn't support the following features:
28
29
 
29
30
  - UDP
30
- - Unix domain sockets
31
+ - Unix Domain Sockets
31
32
  - SSL
32
33
  - debugging
33
34
 
@@ -40,9 +41,7 @@ RLoop also doesn't implement the following methods:
40
41
  - `loop.sock_sendto`
41
42
  - `loop.sock_sendfile`
42
43
 
43
- ### Differences in behaviour
44
-
45
- #### `call_later` with negative delays
44
+ ### `call_later` with negative delays
46
45
 
47
46
  While the stdlib's event loop will use the actual delay of callbacks when `call_later` is used with negative numbers, RLoop will treat those as `call_soon`, and thus the effective order will follow the invocation order, not the delay.
48
47
 
@@ -45,6 +45,7 @@ class EventLoop:
45
45
  def _ssock_del(self, fd): ...
46
46
  def _tcp_conn(self, sock, protocol_factory: Callable[[], T]) -> Tuple[Any, T]: ...
47
47
  def _tcp_server(self, socks, rsocks, protocol_factory, backlog) -> Server: ...
48
+ def _tcp_stream_bound(self, fd) -> bool: ...
48
49
  def add_reader(self, fd, callback, *args) -> CBHandle: ...
49
50
  def add_writer(self, fd, callback, *args) -> CBHandle: ...
50
51
  def call_soon(self, callback, *args, context=None) -> CBHandle: ...
@@ -751,9 +751,21 @@ class RLoop(__BaseLoop, __asyncio.AbstractEventLoop):
751
751
  self.call_soon_threadsafe(transp._process_exited, returncode)
752
752
 
753
753
  #: completion based I/O methods
754
+ def _ensure_fd_no_transport(self, fd):
755
+ fileno = fd
756
+ if not isinstance(fileno, int):
757
+ try:
758
+ fileno = int(fileno.fileno())
759
+ except (AttributeError, TypeError, ValueError):
760
+ raise ValueError(f'Invalid file object: {fd!r}') from None
761
+ if self._tcp_stream_bound(fileno):
762
+ raise RuntimeError(f'File descriptor {fd!r} is used by transport')
763
+
754
764
  def sock_recv(self, sock, nbytes) -> _Future:
755
765
  future = _SyncSockReaderFuture(sock, self)
756
- self.add_reader(sock.fileno(), self._sock_recv, future, sock, nbytes)
766
+ fd = sock.fileno()
767
+ self._ensure_fd_no_transport(fd)
768
+ self.add_reader(fd, self._sock_recv, future, sock, nbytes)
757
769
  return future
758
770
 
759
771
  def _sock_recv(self, fut, sock, n):
@@ -772,7 +784,9 @@ class RLoop(__BaseLoop, __asyncio.AbstractEventLoop):
772
784
 
773
785
  def sock_recv_into(self, sock, buf) -> _Future:
774
786
  future = _SyncSockReaderFuture(sock, self)
775
- self.add_reader(sock.fileno(), self._sock_recv_into, future, sock, buf)
787
+ fd = sock.fileno()
788
+ self._ensure_fd_no_transport(fd)
789
+ self.add_reader(fd, self._sock_recv_into, future, sock, buf)
776
790
  return future
777
791
 
778
792
  def _sock_recv_into(self, fut, sock, buf):
@@ -809,8 +823,10 @@ class RLoop(__BaseLoop, __asyncio.AbstractEventLoop):
809
823
  data = memoryview(data)
810
824
  data = data[n:]
811
825
 
826
+ fd = sock.fileno()
827
+ self._ensure_fd_no_transport(fd)
812
828
  future = _SyncSockWriterFuture(sock, self)
813
- self.add_writer(sock.fileno(), self._sock_sendall, future, sock, data)
829
+ self.add_writer(fd, self._sock_sendall, future, sock, data)
814
830
  return await future
815
831
 
816
832
  def _sock_sendall(self, fut, sock, data):
@@ -866,8 +882,10 @@ class RLoop(__BaseLoop, __asyncio.AbstractEventLoop):
866
882
  else:
867
883
  return
868
884
 
885
+ fd = sock.fileno()
886
+ self._ensure_fd_no_transport(fd)
869
887
  future = _SyncSockWriterFuture(sock, self)
870
- self.add_writer(sock.fileno(), self._sock_connect_cb, future, sock, address)
888
+ self.add_writer(fd, self._sock_connect_cb, future, sock, address)
871
889
  return future
872
890
 
873
891
  def _sock_connect_cb(self, fut, sock, address):
@@ -888,8 +906,10 @@ class RLoop(__BaseLoop, __asyncio.AbstractEventLoop):
888
906
  self.remove_writer(sock.fileno())
889
907
 
890
908
  def sock_accept(self, sock) -> _Future:
909
+ fd = sock.fileno()
910
+ self._ensure_fd_no_transport(fd)
891
911
  future = _SyncSockReaderFuture(sock, self)
892
- self.add_reader(sock.fileno(), self._sock_accept, future, sock)
912
+ self.add_reader(fd, self._sock_accept, future, sock)
893
913
  return future
894
914
 
895
915
  def _sock_accept(self, fut, sock):