halton 0.2.1 → 0.2.1.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/ext/halton/Cargo.lock +445 -0
- data/ext/halton/Cargo.toml +1 -2
- data/ext/halton/Rakefile +58 -5
- data/ext/halton/src/lib.rs +108 -75
- data/lib/halton.rb +10 -27
- metadata +5 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 367da6d10b20e537ed6a0bb6153bc95ab3c09313b9edd71736315708d60eafbe
|
4
|
+
data.tar.gz: ca90d4c261f13077f2294e23d14de023074649a4e0e39faa56ca550e6eeb0210
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f936ff151b3964e44220d8a1036e0ed710eaf7821e633e361ef36b21307569c4be6bee16ee79cecc6c8492f6f69755745e91d953fd75e79308a0468a8fe63e0c
|
7
|
+
data.tar.gz: fa78a84ab664803a29762e9c968c5dd048f9655525f47134622a687fa7e9dfb9d86f169ab2ccb2fb7a2c8a279c2683c09d489344d5767e9cc689c1325bdd4445
|
@@ -0,0 +1,445 @@
|
|
1
|
+
# This file is automatically @generated by Cargo.
|
2
|
+
# It is not intended for manual editing.
|
3
|
+
version = 3
|
4
|
+
|
5
|
+
[[package]]
|
6
|
+
name = "aho-corasick"
|
7
|
+
version = "0.7.18"
|
8
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
9
|
+
checksum = "1e37cfd5e7657ada45f742d6e99ca5788580b5c529dc78faf11ece6dc702656f"
|
10
|
+
dependencies = [
|
11
|
+
"memchr",
|
12
|
+
]
|
13
|
+
|
14
|
+
[[package]]
|
15
|
+
name = "ansi_term"
|
16
|
+
version = "0.12.1"
|
17
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
18
|
+
checksum = "d52a9bb7ec0cf484c551830a7ce27bd20d67eac647e1befb56b0be4ee39a55d2"
|
19
|
+
dependencies = [
|
20
|
+
"winapi",
|
21
|
+
]
|
22
|
+
|
23
|
+
[[package]]
|
24
|
+
name = "atty"
|
25
|
+
version = "0.2.14"
|
26
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
27
|
+
checksum = "d9b39be18770d11421cdb1b9947a45dd3f37e93092cbf377614828a319d5fee8"
|
28
|
+
dependencies = [
|
29
|
+
"hermit-abi",
|
30
|
+
"libc",
|
31
|
+
"winapi",
|
32
|
+
]
|
33
|
+
|
34
|
+
[[package]]
|
35
|
+
name = "bindgen"
|
36
|
+
version = "0.59.2"
|
37
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
38
|
+
checksum = "2bd2a9a458e8f4304c52c43ebb0cfbd520289f8379a52e329a38afda99bf8eb8"
|
39
|
+
dependencies = [
|
40
|
+
"bitflags",
|
41
|
+
"cexpr",
|
42
|
+
"clang-sys",
|
43
|
+
"clap",
|
44
|
+
"env_logger",
|
45
|
+
"lazy_static",
|
46
|
+
"lazycell",
|
47
|
+
"log",
|
48
|
+
"peeking_take_while",
|
49
|
+
"proc-macro2",
|
50
|
+
"quote",
|
51
|
+
"regex",
|
52
|
+
"rustc-hash",
|
53
|
+
"shlex",
|
54
|
+
"which",
|
55
|
+
]
|
56
|
+
|
57
|
+
[[package]]
|
58
|
+
name = "bitflags"
|
59
|
+
version = "1.3.2"
|
60
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
61
|
+
checksum = "bef38d45163c2f1dde094a7dfd33ccf595c92905c8f8f4fdc18d06fb1037718a"
|
62
|
+
|
63
|
+
[[package]]
|
64
|
+
name = "cexpr"
|
65
|
+
version = "0.6.0"
|
66
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
67
|
+
checksum = "6fac387a98bb7c37292057cffc56d62ecb629900026402633ae9160df93a8766"
|
68
|
+
dependencies = [
|
69
|
+
"nom",
|
70
|
+
]
|
71
|
+
|
72
|
+
[[package]]
|
73
|
+
name = "cfg-if"
|
74
|
+
version = "1.0.0"
|
75
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
76
|
+
checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd"
|
77
|
+
|
78
|
+
[[package]]
|
79
|
+
name = "clang-sys"
|
80
|
+
version = "1.3.1"
|
81
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
82
|
+
checksum = "4cc00842eed744b858222c4c9faf7243aafc6d33f92f96935263ef4d8a41ce21"
|
83
|
+
dependencies = [
|
84
|
+
"glob",
|
85
|
+
"libc",
|
86
|
+
"libloading",
|
87
|
+
]
|
88
|
+
|
89
|
+
[[package]]
|
90
|
+
name = "clap"
|
91
|
+
version = "2.34.0"
|
92
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
93
|
+
checksum = "a0610544180c38b88101fecf2dd634b174a62eef6946f84dfc6a7127512b381c"
|
94
|
+
dependencies = [
|
95
|
+
"ansi_term",
|
96
|
+
"atty",
|
97
|
+
"bitflags",
|
98
|
+
"strsim 0.8.0",
|
99
|
+
"textwrap",
|
100
|
+
"unicode-width",
|
101
|
+
"vec_map",
|
102
|
+
]
|
103
|
+
|
104
|
+
[[package]]
|
105
|
+
name = "darling"
|
106
|
+
version = "0.13.1"
|
107
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
108
|
+
checksum = "d0d720b8683f8dd83c65155f0530560cba68cd2bf395f6513a483caee57ff7f4"
|
109
|
+
dependencies = [
|
110
|
+
"darling_core",
|
111
|
+
"darling_macro",
|
112
|
+
]
|
113
|
+
|
114
|
+
[[package]]
|
115
|
+
name = "darling_core"
|
116
|
+
version = "0.13.1"
|
117
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
118
|
+
checksum = "7a340f241d2ceed1deb47ae36c4144b2707ec7dd0b649f894cb39bb595986324"
|
119
|
+
dependencies = [
|
120
|
+
"fnv",
|
121
|
+
"ident_case",
|
122
|
+
"proc-macro2",
|
123
|
+
"quote",
|
124
|
+
"strsim 0.10.0",
|
125
|
+
"syn",
|
126
|
+
]
|
127
|
+
|
128
|
+
[[package]]
|
129
|
+
name = "darling_macro"
|
130
|
+
version = "0.13.1"
|
131
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
132
|
+
checksum = "72c41b3b7352feb3211a0d743dc5700a4e3b60f51bd2b368892d1e0f9a95f44b"
|
133
|
+
dependencies = [
|
134
|
+
"darling_core",
|
135
|
+
"quote",
|
136
|
+
"syn",
|
137
|
+
]
|
138
|
+
|
139
|
+
[[package]]
|
140
|
+
name = "either"
|
141
|
+
version = "1.6.1"
|
142
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
143
|
+
checksum = "e78d4f1cc4ae33bbfc157ed5d5a5ef3bc29227303d595861deb238fcec4e9457"
|
144
|
+
|
145
|
+
[[package]]
|
146
|
+
name = "env_logger"
|
147
|
+
version = "0.9.0"
|
148
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
149
|
+
checksum = "0b2cf0344971ee6c64c31be0d530793fba457d322dfec2810c453d0ef228f9c3"
|
150
|
+
dependencies = [
|
151
|
+
"atty",
|
152
|
+
"humantime",
|
153
|
+
"log",
|
154
|
+
"regex",
|
155
|
+
"termcolor",
|
156
|
+
]
|
157
|
+
|
158
|
+
[[package]]
|
159
|
+
name = "fnv"
|
160
|
+
version = "1.0.7"
|
161
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
162
|
+
checksum = "3f9eec918d3f24069decb9af1554cad7c880e2da24a9afd88aca000531ab82c1"
|
163
|
+
|
164
|
+
[[package]]
|
165
|
+
name = "glob"
|
166
|
+
version = "0.3.0"
|
167
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
168
|
+
checksum = "9b919933a397b79c37e33b77bb2aa3dc8eb6e165ad809e58ff75bc7db2e34574"
|
169
|
+
|
170
|
+
[[package]]
|
171
|
+
name = "halton"
|
172
|
+
version = "0.1.0"
|
173
|
+
dependencies = [
|
174
|
+
"halton 0.2.1",
|
175
|
+
"magnus",
|
176
|
+
]
|
177
|
+
|
178
|
+
[[package]]
|
179
|
+
name = "halton"
|
180
|
+
version = "0.2.1"
|
181
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
182
|
+
checksum = "be629448e3d85a1be12868f190df524655fea8ec3f143e14d803e298f618acae"
|
183
|
+
|
184
|
+
[[package]]
|
185
|
+
name = "hermit-abi"
|
186
|
+
version = "0.1.19"
|
187
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
188
|
+
checksum = "62b467343b94ba476dcb2500d242dadbb39557df889310ac77c5d99100aaac33"
|
189
|
+
dependencies = [
|
190
|
+
"libc",
|
191
|
+
]
|
192
|
+
|
193
|
+
[[package]]
|
194
|
+
name = "humantime"
|
195
|
+
version = "2.1.0"
|
196
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
197
|
+
checksum = "9a3a5bfb195931eeb336b2a7b4d761daec841b97f947d34394601737a7bba5e4"
|
198
|
+
|
199
|
+
[[package]]
|
200
|
+
name = "ident_case"
|
201
|
+
version = "1.0.1"
|
202
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
203
|
+
checksum = "b9e0384b61958566e926dc50660321d12159025e767c18e043daf26b70104c39"
|
204
|
+
|
205
|
+
[[package]]
|
206
|
+
name = "lazy_static"
|
207
|
+
version = "1.4.0"
|
208
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
209
|
+
checksum = "e2abad23fbc42b3700f2f279844dc832adb2b2eb069b2df918f455c4e18cc646"
|
210
|
+
|
211
|
+
[[package]]
|
212
|
+
name = "lazycell"
|
213
|
+
version = "1.3.0"
|
214
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
215
|
+
checksum = "830d08ce1d1d941e6b30645f1a0eb5643013d835ce3779a5fc208261dbe10f55"
|
216
|
+
|
217
|
+
[[package]]
|
218
|
+
name = "libc"
|
219
|
+
version = "0.2.119"
|
220
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
221
|
+
checksum = "1bf2e165bb3457c8e098ea76f3e3bc9db55f87aa90d52d0e6be741470916aaa4"
|
222
|
+
|
223
|
+
[[package]]
|
224
|
+
name = "libloading"
|
225
|
+
version = "0.7.3"
|
226
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
227
|
+
checksum = "efbc0f03f9a775e9f6aed295c6a1ba2253c5757a9e03d55c6caa46a681abcddd"
|
228
|
+
dependencies = [
|
229
|
+
"cfg-if",
|
230
|
+
"winapi",
|
231
|
+
]
|
232
|
+
|
233
|
+
[[package]]
|
234
|
+
name = "log"
|
235
|
+
version = "0.4.14"
|
236
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
237
|
+
checksum = "51b9bbe6c47d51fc3e1a9b945965946b4c44142ab8792c50835a980d362c2710"
|
238
|
+
dependencies = [
|
239
|
+
"cfg-if",
|
240
|
+
]
|
241
|
+
|
242
|
+
[[package]]
|
243
|
+
name = "magnus"
|
244
|
+
version = "0.3.1"
|
245
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
246
|
+
checksum = "e772e3622600833393ebd9c89a5f963a9c9699528cb60764e7f178e0cc96344a"
|
247
|
+
dependencies = [
|
248
|
+
"bindgen",
|
249
|
+
"magnus-macros",
|
250
|
+
]
|
251
|
+
|
252
|
+
[[package]]
|
253
|
+
name = "magnus-macros"
|
254
|
+
version = "0.1.0"
|
255
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
256
|
+
checksum = "27968fcabe2ef7e35b8331d71a62882282996f6222c133c0255cf7f33b8d9b48"
|
257
|
+
dependencies = [
|
258
|
+
"darling",
|
259
|
+
"proc-macro2",
|
260
|
+
"quote",
|
261
|
+
"syn",
|
262
|
+
]
|
263
|
+
|
264
|
+
[[package]]
|
265
|
+
name = "memchr"
|
266
|
+
version = "2.4.1"
|
267
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
268
|
+
checksum = "308cc39be01b73d0d18f82a0e7b2a3df85245f84af96fdddc5d202d27e47b86a"
|
269
|
+
|
270
|
+
[[package]]
|
271
|
+
name = "minimal-lexical"
|
272
|
+
version = "0.2.1"
|
273
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
274
|
+
checksum = "68354c5c6bd36d73ff3feceb05efa59b6acb7626617f4962be322a825e61f79a"
|
275
|
+
|
276
|
+
[[package]]
|
277
|
+
name = "nom"
|
278
|
+
version = "7.1.0"
|
279
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
280
|
+
checksum = "1b1d11e1ef389c76fe5b81bcaf2ea32cf88b62bc494e19f493d0b30e7a930109"
|
281
|
+
dependencies = [
|
282
|
+
"memchr",
|
283
|
+
"minimal-lexical",
|
284
|
+
"version_check",
|
285
|
+
]
|
286
|
+
|
287
|
+
[[package]]
|
288
|
+
name = "peeking_take_while"
|
289
|
+
version = "0.1.2"
|
290
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
291
|
+
checksum = "19b17cddbe7ec3f8bc800887bab5e717348c95ea2ca0b1bf0837fb964dc67099"
|
292
|
+
|
293
|
+
[[package]]
|
294
|
+
name = "proc-macro2"
|
295
|
+
version = "1.0.36"
|
296
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
297
|
+
checksum = "c7342d5883fbccae1cc37a2353b09c87c9b0f3afd73f5fb9bba687a1f733b029"
|
298
|
+
dependencies = [
|
299
|
+
"unicode-xid",
|
300
|
+
]
|
301
|
+
|
302
|
+
[[package]]
|
303
|
+
name = "quote"
|
304
|
+
version = "1.0.15"
|
305
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
306
|
+
checksum = "864d3e96a899863136fc6e99f3d7cae289dafe43bf2c5ac19b70df7210c0a145"
|
307
|
+
dependencies = [
|
308
|
+
"proc-macro2",
|
309
|
+
]
|
310
|
+
|
311
|
+
[[package]]
|
312
|
+
name = "regex"
|
313
|
+
version = "1.5.4"
|
314
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
315
|
+
checksum = "d07a8629359eb56f1e2fb1652bb04212c072a87ba68546a04065d525673ac461"
|
316
|
+
dependencies = [
|
317
|
+
"aho-corasick",
|
318
|
+
"memchr",
|
319
|
+
"regex-syntax",
|
320
|
+
]
|
321
|
+
|
322
|
+
[[package]]
|
323
|
+
name = "regex-syntax"
|
324
|
+
version = "0.6.25"
|
325
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
326
|
+
checksum = "f497285884f3fcff424ffc933e56d7cbca511def0c9831a7f9b5f6153e3cc89b"
|
327
|
+
|
328
|
+
[[package]]
|
329
|
+
name = "rustc-hash"
|
330
|
+
version = "1.1.0"
|
331
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
332
|
+
checksum = "08d43f7aa6b08d49f382cde6a7982047c3426db949b1424bc4b7ec9ae12c6ce2"
|
333
|
+
|
334
|
+
[[package]]
|
335
|
+
name = "shlex"
|
336
|
+
version = "1.1.0"
|
337
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
338
|
+
checksum = "43b2853a4d09f215c24cc5489c992ce46052d359b5109343cbafbf26bc62f8a3"
|
339
|
+
|
340
|
+
[[package]]
|
341
|
+
name = "strsim"
|
342
|
+
version = "0.8.0"
|
343
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
344
|
+
checksum = "8ea5119cdb4c55b55d432abb513a0429384878c15dde60cc77b1c99de1a95a6a"
|
345
|
+
|
346
|
+
[[package]]
|
347
|
+
name = "strsim"
|
348
|
+
version = "0.10.0"
|
349
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
350
|
+
checksum = "73473c0e59e6d5812c5dfe2a064a6444949f089e20eec9a2e5506596494e4623"
|
351
|
+
|
352
|
+
[[package]]
|
353
|
+
name = "syn"
|
354
|
+
version = "1.0.86"
|
355
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
356
|
+
checksum = "8a65b3f4ffa0092e9887669db0eae07941f023991ab58ea44da8fe8e2d511c6b"
|
357
|
+
dependencies = [
|
358
|
+
"proc-macro2",
|
359
|
+
"quote",
|
360
|
+
"unicode-xid",
|
361
|
+
]
|
362
|
+
|
363
|
+
[[package]]
|
364
|
+
name = "termcolor"
|
365
|
+
version = "1.1.2"
|
366
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
367
|
+
checksum = "2dfed899f0eb03f32ee8c6a0aabdb8a7949659e3466561fc0adf54e26d88c5f4"
|
368
|
+
dependencies = [
|
369
|
+
"winapi-util",
|
370
|
+
]
|
371
|
+
|
372
|
+
[[package]]
|
373
|
+
name = "textwrap"
|
374
|
+
version = "0.11.0"
|
375
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
376
|
+
checksum = "d326610f408c7a4eb6f51c37c330e496b08506c9457c9d34287ecc38809fb060"
|
377
|
+
dependencies = [
|
378
|
+
"unicode-width",
|
379
|
+
]
|
380
|
+
|
381
|
+
[[package]]
|
382
|
+
name = "unicode-width"
|
383
|
+
version = "0.1.9"
|
384
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
385
|
+
checksum = "3ed742d4ea2bd1176e236172c8429aaf54486e7ac098db29ffe6529e0ce50973"
|
386
|
+
|
387
|
+
[[package]]
|
388
|
+
name = "unicode-xid"
|
389
|
+
version = "0.2.2"
|
390
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
391
|
+
checksum = "8ccb82d61f80a663efe1f787a51b16b5a51e3314d6ac365b08639f52387b33f3"
|
392
|
+
|
393
|
+
[[package]]
|
394
|
+
name = "vec_map"
|
395
|
+
version = "0.8.2"
|
396
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
397
|
+
checksum = "f1bddf1187be692e79c5ffeab891132dfb0f236ed36a43c7ed39f1165ee20191"
|
398
|
+
|
399
|
+
[[package]]
|
400
|
+
name = "version_check"
|
401
|
+
version = "0.9.4"
|
402
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
403
|
+
checksum = "49874b5167b65d7193b8aba1567f5c7d93d001cafc34600cee003eda787e483f"
|
404
|
+
|
405
|
+
[[package]]
|
406
|
+
name = "which"
|
407
|
+
version = "4.2.4"
|
408
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
409
|
+
checksum = "2a5a7e487e921cf220206864a94a89b6c6905bfc19f1057fa26a4cb360e5c1d2"
|
410
|
+
dependencies = [
|
411
|
+
"either",
|
412
|
+
"lazy_static",
|
413
|
+
"libc",
|
414
|
+
]
|
415
|
+
|
416
|
+
[[package]]
|
417
|
+
name = "winapi"
|
418
|
+
version = "0.3.9"
|
419
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
420
|
+
checksum = "5c839a674fcd7a98952e593242ea400abe93992746761e38641405d28b00f419"
|
421
|
+
dependencies = [
|
422
|
+
"winapi-i686-pc-windows-gnu",
|
423
|
+
"winapi-x86_64-pc-windows-gnu",
|
424
|
+
]
|
425
|
+
|
426
|
+
[[package]]
|
427
|
+
name = "winapi-i686-pc-windows-gnu"
|
428
|
+
version = "0.4.0"
|
429
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
430
|
+
checksum = "ac3b87c63620426dd9b991e5ce0329eff545bccbbb34f3be09ff6fb6ab51b7b6"
|
431
|
+
|
432
|
+
[[package]]
|
433
|
+
name = "winapi-util"
|
434
|
+
version = "0.1.5"
|
435
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
436
|
+
checksum = "70ec6ce85bb158151cae5e5c87f95a8e97d2c0c4b001223f33a334e3ce5de178"
|
437
|
+
dependencies = [
|
438
|
+
"winapi",
|
439
|
+
]
|
440
|
+
|
441
|
+
[[package]]
|
442
|
+
name = "winapi-x86_64-pc-windows-gnu"
|
443
|
+
version = "0.4.0"
|
444
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
445
|
+
checksum = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f"
|
data/ext/halton/Cargo.toml
CHANGED
data/ext/halton/Rakefile
CHANGED
@@ -1,9 +1,11 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
+
require "shellwords"
|
4
|
+
|
3
5
|
class RakeCargoHelper
|
4
6
|
attr_reader :gemname
|
5
7
|
|
6
|
-
def initialize(gemname)
|
8
|
+
def initialize(gemname=File.basename(__dir__))
|
7
9
|
@gemname = gemname
|
8
10
|
end
|
9
11
|
|
@@ -36,13 +38,63 @@ class RakeCargoHelper
|
|
36
38
|
@cargo_target_dir = dir || "target"
|
37
39
|
end
|
38
40
|
|
41
|
+
def self.flags
|
42
|
+
cc_flags = Shellwords.split(RbConfig.expand(RbConfig::MAKEFILE_CONFIG["CC"].dup))
|
43
|
+
|
44
|
+
["-C", "linker=#{cc_flags.shift}",
|
45
|
+
*cc_flags.flat_map {|a| ["-C", "link-arg=#{a}"] },
|
46
|
+
"-L", "native=#{RbConfig::CONFIG["libdir"]}",
|
47
|
+
*dld_flags,
|
48
|
+
*platform_flags]
|
49
|
+
end
|
50
|
+
|
51
|
+
def self.dld_flags
|
52
|
+
Shellwords.split(RbConfig::CONFIG["DLDFLAGS"]).flat_map do |arg|
|
53
|
+
arg = arg.gsub(/\$\((\w+)\)/) do
|
54
|
+
$1 == "DEFFILE" ? nil : RbConfig::CONFIG[name]
|
55
|
+
end.strip
|
56
|
+
next [] if arg.empty?
|
57
|
+
|
58
|
+
transform_flag(arg)
|
59
|
+
end
|
60
|
+
end
|
61
|
+
|
62
|
+
def self.platform_flags
|
63
|
+
return unless RbConfig::CONFIG["target_os"] =~ /mingw/i
|
64
|
+
|
65
|
+
[*Shellwords.split(RbConfig::CONFIG["LIBRUBYARG"]).flat_map {|arg| transform_flag(arg)},
|
66
|
+
"-C", "link-arg=-Wl,--dynamicbase",
|
67
|
+
"-C", "link-arg=-Wl,--disable-auto-image-base",
|
68
|
+
"-C", "link-arg=-static-libgcc"]
|
69
|
+
end
|
70
|
+
|
71
|
+
def self.transform_flag(arg)
|
72
|
+
k, v = arg.split(/(?<=..)/, 2)
|
73
|
+
case k
|
74
|
+
when "-L"
|
75
|
+
[k, "native=#{v}"]
|
76
|
+
when "-l"
|
77
|
+
[k, v]
|
78
|
+
when "-F"
|
79
|
+
["-l", "framework=#{v}"]
|
80
|
+
else
|
81
|
+
["-C", "link_arg=#{k}#{v}"]
|
82
|
+
end
|
83
|
+
end
|
84
|
+
|
39
85
|
def install_dir
|
40
86
|
File.expand_path(File.join("..", "..", "lib", gemname), __dir__)
|
41
87
|
end
|
42
88
|
|
43
89
|
def rust_name
|
44
90
|
prefix = "lib" unless Gem.win_platform?
|
45
|
-
suffix = RbConfig::CONFIG["target_os"] =~ /darwin/i
|
91
|
+
suffix = if RbConfig::CONFIG["target_os"] =~ /darwin/i
|
92
|
+
".dylib"
|
93
|
+
elsif Gem.win_platform?
|
94
|
+
".dll"
|
95
|
+
else
|
96
|
+
".so"
|
97
|
+
end
|
46
98
|
"#{prefix}#{gemname}#{suffix}"
|
47
99
|
end
|
48
100
|
|
@@ -61,22 +113,23 @@ end
|
|
61
113
|
|
62
114
|
desc "build gem native extension and copy to lib"
|
63
115
|
task install: [:cd, :build] do
|
64
|
-
helper = RakeCargoHelper.new
|
116
|
+
helper = RakeCargoHelper.new
|
65
117
|
profile_dir = @dev ? "debug" : "release"
|
66
118
|
source = File.join(RakeCargoHelper.cargo_target_dir, profile_dir, helper.rust_name)
|
67
119
|
dest = File.join(helper.install_dir, helper.ruby_name)
|
68
120
|
mkdir_p(helper.install_dir)
|
121
|
+
rm(dest) if File.exist?(dest)
|
69
122
|
cp(source, dest)
|
70
123
|
end
|
71
124
|
|
72
125
|
desc "build gem native extension"
|
73
126
|
task build: [:cargo, :cd] do
|
74
|
-
sh "cargo", "
|
127
|
+
sh "cargo", "rustc", *(["--locked", "--release"] unless @dev), "--", *RakeCargoHelper.flags
|
75
128
|
end
|
76
129
|
|
77
130
|
desc "clean up release build artifacts"
|
78
131
|
task clean: [:cargo, :cd] do
|
79
|
-
|
132
|
+
sh "cargo clean --release"
|
80
133
|
end
|
81
134
|
|
82
135
|
desc "clean up build artifacts"
|
data/ext/halton/src/lib.rs
CHANGED
@@ -1,88 +1,121 @@
|
|
1
|
-
use
|
2
|
-
|
3
|
-
|
4
|
-
|
1
|
+
use std::cell::RefCell;
|
2
|
+
|
3
|
+
use magnus::{
|
4
|
+
block::{block_given, Yield, YieldSplat, YieldValues},
|
5
|
+
define_module, exception, function, method,
|
6
|
+
prelude::*,
|
7
|
+
Error, RArray, Value,
|
5
8
|
};
|
6
9
|
|
7
|
-
|
8
|
-
|
9
|
-
#[allow(clippy::redundant_closure)]
|
10
|
-
$val.map_err(|e| VM::raise_ex(e))
|
11
|
-
.expect("exception should have been raised")
|
12
|
-
};
|
13
|
-
}
|
10
|
+
#[magnus::wrap(class = "Halton::Sequence", free_immediatly, size)]
|
11
|
+
struct Sequence(RefCell<halton::Sequence>);
|
14
12
|
|
15
|
-
|
16
|
-
(
|
17
|
-
|
18
|
-
|
19
|
-
}};
|
20
|
-
}
|
13
|
+
impl Sequence {
|
14
|
+
fn new(base: u8) -> Self {
|
15
|
+
Self(RefCell::new(halton::Sequence::new(base)))
|
16
|
+
}
|
21
17
|
|
22
|
-
fn
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
18
|
+
fn next(&self) -> Result<f64, Error> {
|
19
|
+
match self.0.try_borrow_mut().unwrap().next() {
|
20
|
+
Some(f) => Ok(f),
|
21
|
+
None => Err(Error::new(
|
22
|
+
exception::stop_iteration(),
|
23
|
+
"iteration reached an end",
|
24
|
+
)),
|
25
|
+
}
|
26
|
+
}
|
29
27
|
|
30
|
-
|
28
|
+
fn skip(&self, n: usize) {
|
29
|
+
self.0.try_borrow_mut().unwrap().nth(n);
|
30
|
+
}
|
31
|
+
|
32
|
+
fn remaining(&self) -> Option<usize> {
|
33
|
+
self.0.try_borrow().unwrap().size_hint().1
|
34
|
+
}
|
35
|
+
}
|
31
36
|
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
fn halton_number(base: Integer, index: Integer) -> Float {
|
36
|
-
Float::new(halton::number(
|
37
|
-
unwrap_raise!(base).to_u64() as u8,
|
38
|
-
unwrap_raise!(index).to_u64() as usize,
|
39
|
-
))
|
37
|
+
fn each_one(rb_self: Value, base: u8) -> Yield<impl Iterator<Item = f64>> {
|
38
|
+
if !block_given() {
|
39
|
+
return Yield::Enumerator(rb_self.enumeratorize("each_one", (base,)));
|
40
40
|
}
|
41
|
-
)
|
41
|
+
Yield::Iter(halton::Sequence::new(base))
|
42
|
+
}
|
42
43
|
|
43
|
-
|
44
|
+
fn each_pair(
|
45
|
+
rb_self: Value,
|
46
|
+
x_base: u8,
|
47
|
+
y_base: u8,
|
48
|
+
) -> YieldValues<impl Iterator<Item = (f64, f64)>> {
|
49
|
+
if !block_given() {
|
50
|
+
return YieldValues::Enumerator(rb_self.enumeratorize("each_pair", (x_base, y_base)));
|
51
|
+
}
|
52
|
+
let seq_x = halton::Sequence::new(x_base);
|
53
|
+
let seq_y = halton::Sequence::new(y_base);
|
54
|
+
YieldValues::Iter(seq_x.zip(seq_y))
|
55
|
+
}
|
44
56
|
|
45
|
-
|
57
|
+
fn each_triple(
|
58
|
+
rb_self: Value,
|
59
|
+
x_base: u8,
|
60
|
+
y_base: u8,
|
61
|
+
z_base: u8,
|
62
|
+
) -> YieldValues<impl Iterator<Item = (f64, f64, f64)>> {
|
63
|
+
if !block_given() {
|
64
|
+
return YieldValues::Enumerator(
|
65
|
+
rb_self.enumeratorize("each_triple", (x_base, y_base, z_base)),
|
66
|
+
);
|
67
|
+
}
|
68
|
+
let seq_x = halton::Sequence::new(x_base);
|
69
|
+
let seq_y = halton::Sequence::new(y_base);
|
70
|
+
let seq_z = halton::Sequence::new(z_base);
|
71
|
+
YieldValues::Iter(seq_x.zip(seq_y).zip(seq_z).map(|((x, y), z)| (x, y, z)))
|
72
|
+
}
|
46
73
|
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
}
|
62
|
-
},
|
63
|
-
fn halton_sequence_skip(n: Integer) -> NilClass {
|
64
|
-
let seq = rtself.get_data_mut(&*SEQUENCE_WRAPPER);
|
65
|
-
seq.nth(unwrap_raise!(n).to_u64() as usize);
|
66
|
-
NilClass::new()
|
67
|
-
},
|
68
|
-
fn halton_sequence_remaining() -> AnyObject {
|
69
|
-
let seq = rtself.get_data(&*SEQUENCE_WRAPPER);
|
70
|
-
any_object_or_nil(seq.size_hint().1.map(|i| Integer::new(i as i64)))
|
74
|
+
fn each_many(
|
75
|
+
rb_self: Value,
|
76
|
+
bases: &[Value],
|
77
|
+
) -> Result<YieldSplat<impl Iterator<Item = RArray>>, Error> {
|
78
|
+
if bases.is_empty() {
|
79
|
+
return Err(Error::new(
|
80
|
+
exception::arg_error(),
|
81
|
+
"wrong number of arguments (given 0, expected 1+)",
|
82
|
+
));
|
83
|
+
}
|
84
|
+
if !block_given() {
|
85
|
+
return Ok(YieldSplat::Enumerator(
|
86
|
+
rb_self.enumeratorize("each_many", bases),
|
87
|
+
));
|
71
88
|
}
|
72
|
-
|
89
|
+
let mut seqs = bases
|
90
|
+
.iter()
|
91
|
+
.map(|v| v.try_convert().map(halton::Sequence::new))
|
92
|
+
.collect::<Result<Vec<_>, _>>()?;
|
93
|
+
let mut buffer = Vec::<Value>::with_capacity(seqs.len());
|
94
|
+
Ok(YieldSplat::Iter(std::iter::from_fn(move || {
|
95
|
+
buffer.clear();
|
96
|
+
for seq in &mut seqs {
|
97
|
+
if let Some(v) = seq.next() {
|
98
|
+
buffer.push(v.into());
|
99
|
+
} else {
|
100
|
+
return None;
|
101
|
+
}
|
102
|
+
}
|
103
|
+
Some(RArray::from_slice(&buffer))
|
104
|
+
})))
|
105
|
+
}
|
73
106
|
|
74
|
-
#[
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
|
84
|
-
|
85
|
-
|
86
|
-
|
87
|
-
|
107
|
+
#[magnus::init]
|
108
|
+
fn init() -> Result<(), Error> {
|
109
|
+
let module = define_module("Halton")?;
|
110
|
+
module.define_singleton_method("number", function!(halton::number, 2))?;
|
111
|
+
module.define_singleton_method("each_one", method!(each_one, 1))?;
|
112
|
+
module.define_singleton_method("each_pair", method!(each_pair, 2))?;
|
113
|
+
module.define_singleton_method("each_triple", method!(each_triple, 3))?;
|
114
|
+
module.define_singleton_method("each_many", method!(each_many, -1))?;
|
115
|
+
let class = module.define_class("Sequence", Default::default())?;
|
116
|
+
class.define_singleton_method("new", function!(Sequence::new, 1))?;
|
117
|
+
class.define_method("next", method!(Sequence::next, 0))?;
|
118
|
+
class.define_method("skip", method!(Sequence::skip, 1))?;
|
119
|
+
class.define_method("remaining", method!(Sequence::remaining, 0))?;
|
120
|
+
Ok(())
|
88
121
|
}
|
data/lib/halton.rb
CHANGED
@@ -68,33 +68,17 @@ module Halton
|
|
68
68
|
#
|
69
69
|
# The numbers yielded will be in the range > 0 and < 1.
|
70
70
|
#
|
71
|
-
def self.each(base, *bases)
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
x = Sequence.new(base)
|
82
|
-
y = Sequence.new(bases.first)
|
83
|
-
loop {yield x.next, y.next}
|
84
|
-
return nil
|
71
|
+
def self.each(base, *bases, &block)
|
72
|
+
case bases.length
|
73
|
+
when 0
|
74
|
+
each_one(base, &block)
|
75
|
+
when 1
|
76
|
+
each_pair(base, bases.first, &block)
|
77
|
+
when 2
|
78
|
+
each_triple(base, bases.first, bases.last, &block)
|
79
|
+
else
|
80
|
+
each_many(*bases.unshift(base), &block)
|
85
81
|
end
|
86
|
-
|
87
|
-
if bases.length == 2
|
88
|
-
x = Sequence.new(base)
|
89
|
-
y = Sequence.new(bases.first)
|
90
|
-
z = Sequence.new(bases.last)
|
91
|
-
loop {yield x.next, y.next, z.next}
|
92
|
-
return nil
|
93
|
-
end
|
94
|
-
|
95
|
-
seqs = bases.unshift(base).map {|b| Sequence.new(b)}
|
96
|
-
loop {yield(*seqs.map(&:next))}
|
97
|
-
nil
|
98
82
|
end
|
99
83
|
|
100
84
|
# Halton::Sequence implements the fast generation of Halton sequences.
|
@@ -129,7 +113,6 @@ module Halton
|
|
129
113
|
#
|
130
114
|
# Can be used to efficiently skip large sections of the sequence. For small
|
131
115
|
# values of +n+ simply advances the sequence +n+ times.
|
132
|
-
#
|
133
116
|
|
134
117
|
##
|
135
118
|
# :method: remaining
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: halton
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.2.1
|
4
|
+
version: 0.2.1.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Mat Sadler
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2022-05-25 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rake
|
@@ -36,6 +36,7 @@ extra_rdoc_files:
|
|
36
36
|
- README.rdoc
|
37
37
|
files:
|
38
38
|
- README.rdoc
|
39
|
+
- ext/halton/Cargo.lock
|
39
40
|
- ext/halton/Cargo.toml
|
40
41
|
- ext/halton/Rakefile
|
41
42
|
- ext/halton/src/lib.rs
|
@@ -51,7 +52,7 @@ rdoc_options:
|
|
51
52
|
- "--charset"
|
52
53
|
- utf-8
|
53
54
|
- "--exclude"
|
54
|
-
- ext
|
55
|
+
- ext/
|
55
56
|
require_paths:
|
56
57
|
- lib
|
57
58
|
required_ruby_version: !ruby/object:Gem::Requirement
|
@@ -66,7 +67,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
66
67
|
version: '0'
|
67
68
|
requirements:
|
68
69
|
- Rust >= 1.51.0
|
69
|
-
rubygems_version: 3.
|
70
|
+
rubygems_version: 3.4.0.dev
|
70
71
|
signing_key:
|
71
72
|
specification_version: 4
|
72
73
|
summary: A module for generating Halton sequences
|