deadline_machines 0.1.3 → 0.2.0

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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 97980106bc90405643484bc25918b3112e157c708534e2d18df98f0b80b877b9
4
- data.tar.gz: 7c33368aac315e3f8c08e694c43dfc147791e2b4d60ac3cf520020a111dfac45
3
+ metadata.gz: 997b10f2b56a2c7d52499958c2abf520bc2be53ef9ccd5fbb639ab421f945ae1
4
+ data.tar.gz: aa47f792d0bb875801f705ce899896a6fdd74a7541d6231c6c7cadb1210a2ce9
5
5
  SHA512:
6
- metadata.gz: 99efe524c4df263c52e0b68fa31894c11129487f79cf9a95cf148762f894b599b4a1d8b3590d5d1ad98b04b9e391998a83ebfc62adb9198ec7a08bd8eacd9231
7
- data.tar.gz: 511e87168f39c303f785f393e2edfbb92a18d73f3fed198f06d5395da7fe48eb4b1ae682ea2ef77bb8d9e2284e8af51c3252ac0c8bbb02984bd505610d6f6df7
6
+ metadata.gz: e91c5fa2488f73750981cd354ef0403fa3846334e97e2ef9a2c01dc106867b4c73403e50ca19a8005c36e3ea2c6ce5565efd715f5d5be2a661e39094819e8a68
7
+ data.tar.gz: d79c66ff87c9e574fca21648e84ab821d7b9d2c8a174d7b32accebb876ac3454f4eac9d1a3468bc552cff3ee15ff26d23279b321912658129110e83614b9f75a
data/CHANGELOG.md CHANGED
@@ -1,5 +1,16 @@
1
1
  # Changelog
2
2
 
3
+ ## [0.2.0](https://github.com/seuros/deadline_machines/compare/deadline_machines/v0.1.3...deadline_machines/v0.2.0) (2026-11-16)
4
+
5
+
6
+ ### ⚠ BREAKING CHANGES
7
+
8
+ * split Deadline into a native Data value, Scope and CancelToken
9
+
10
+ ### Features
11
+
12
+ * split Deadline into a native Data value, Scope and CancelToken ([9a4a4ad](https://github.com/seuros/deadline_machines/commit/9a4a4ad1f51feef7fd88d55b1419eee5e93cf5ff))
13
+
3
14
  ## [0.1.3](https://github.com/seuros/deadline_machines/compare/deadline_machines/v0.1.2...deadline_machines/v0.1.3) (2026-11-06)
4
15
 
5
16
 
data/Cargo.lock ADDED
@@ -0,0 +1,371 @@
1
+ # This file is automatically @generated by Cargo.
2
+ # It is not intended for manual editing.
3
+ version = 4
4
+
5
+ [[package]]
6
+ name = "aho-corasick"
7
+ version = "1.1.5"
8
+ source = "registry+https://github.com/rust-lang/crates.io-index"
9
+ checksum = "c982642fa9e8606056828ee9a8505737230110bb1099153c79efe865c59d12ba"
10
+ dependencies = [
11
+ "memchr",
12
+ ]
13
+
14
+ [[package]]
15
+ name = "bindgen"
16
+ version = "0.72.1"
17
+ source = "registry+https://github.com/rust-lang/crates.io-index"
18
+ checksum = "993776b509cfb49c750f11b8f07a46fa23e0a1386ffc01fb1e7d343efc387895"
19
+ dependencies = [
20
+ "bitflags",
21
+ "cexpr",
22
+ "clang-sys",
23
+ "itertools",
24
+ "proc-macro2",
25
+ "quote",
26
+ "regex",
27
+ "rustc-hash",
28
+ "shlex",
29
+ "syn 2.0.119",
30
+ ]
31
+
32
+ [[package]]
33
+ name = "bitflags"
34
+ version = "2.13.2"
35
+ source = "registry+https://github.com/rust-lang/crates.io-index"
36
+ checksum = "3ded4057c258ba199e2d26386d3af3780957ecaee6c4ef4041c6b4b8b97c0b06"
37
+
38
+ [[package]]
39
+ name = "bytes"
40
+ version = "1.12.1"
41
+ source = "registry+https://github.com/rust-lang/crates.io-index"
42
+ checksum = "fc652a48c352aef3ea3aed32080501cf3ef6ed5da78602a020c991775b0aff04"
43
+
44
+ [[package]]
45
+ name = "cexpr"
46
+ version = "0.6.0"
47
+ source = "registry+https://github.com/rust-lang/crates.io-index"
48
+ checksum = "6fac387a98bb7c37292057cffc56d62ecb629900026402633ae9160df93a8766"
49
+ dependencies = [
50
+ "nom",
51
+ ]
52
+
53
+ [[package]]
54
+ name = "cfg-if"
55
+ version = "1.0.5"
56
+ source = "registry+https://github.com/rust-lang/crates.io-index"
57
+ checksum = "4e7648175b45a9a48536d676f68d918270699102aa8dab5496df06904c914600"
58
+
59
+ [[package]]
60
+ name = "clang-sys"
61
+ version = "1.9.1"
62
+ source = "registry+https://github.com/rust-lang/crates.io-index"
63
+ checksum = "157a8ba7b480713b56f4c09fd13fc3e0a22a5dfab8097ba61cbc5feef950788a"
64
+ dependencies = [
65
+ "glob",
66
+ "libc",
67
+ "libloading",
68
+ ]
69
+
70
+ [[package]]
71
+ name = "deadline-machines"
72
+ version = "0.5.0"
73
+ dependencies = [
74
+ "tokio",
75
+ "tokio-util",
76
+ ]
77
+
78
+ [[package]]
79
+ name = "deadline_machines_native"
80
+ version = "0.1.4"
81
+ dependencies = [
82
+ "deadline-machines",
83
+ "magnus",
84
+ "matryona-machines",
85
+ "rb-sys",
86
+ ]
87
+
88
+ [[package]]
89
+ name = "either"
90
+ version = "1.19.0"
91
+ source = "registry+https://github.com/rust-lang/crates.io-index"
92
+ checksum = "0e9c71c2167ca323c882b99918929403426e2373ea17242ff5653e0d5e1058be"
93
+
94
+ [[package]]
95
+ name = "futures-core"
96
+ version = "0.3.34"
97
+ source = "registry+https://github.com/rust-lang/crates.io-index"
98
+ checksum = "92d699e522242e69e3003b94ecc1f960f3a5e015aa7c5d7486e65ad01dd94f5e"
99
+
100
+ [[package]]
101
+ name = "futures-sink"
102
+ version = "0.3.34"
103
+ source = "registry+https://github.com/rust-lang/crates.io-index"
104
+ checksum = "1944426bf7d03f1d14f708785e4b33efd750b36d48a157b836b3efc15ede8e1d"
105
+
106
+ [[package]]
107
+ name = "glob"
108
+ version = "0.3.4"
109
+ source = "registry+https://github.com/rust-lang/crates.io-index"
110
+ checksum = "e4eba85ea1d0a966a983acd07deee566e67395d2d96b6fb39e62b5a833f1eb0b"
111
+
112
+ [[package]]
113
+ name = "itertools"
114
+ version = "0.13.0"
115
+ source = "registry+https://github.com/rust-lang/crates.io-index"
116
+ checksum = "413ee7dfc52ee1a4949ceeb7dbc8a33f2d6c088194d9f922fb8318faf1f01186"
117
+ dependencies = [
118
+ "either",
119
+ ]
120
+
121
+ [[package]]
122
+ name = "lazy_static"
123
+ version = "1.5.1"
124
+ source = "registry+https://github.com/rust-lang/crates.io-index"
125
+ checksum = "20870f649af7073d53e38067b2a84312175d56ea15217e1b15bc83506ec50afb"
126
+
127
+ [[package]]
128
+ name = "libc"
129
+ version = "0.2.191"
130
+ source = "registry+https://github.com/rust-lang/crates.io-index"
131
+ checksum = "65cd87c9a6d60536580b316ad985726104730a5151c99845f2490428ef91240a"
132
+
133
+ [[package]]
134
+ name = "libloading"
135
+ version = "0.8.9"
136
+ source = "registry+https://github.com/rust-lang/crates.io-index"
137
+ checksum = "d7c4b02199fee7c5d21a5ae7d8cfa79a6ef5bb2fc834d6e9058e89c825efdc55"
138
+ dependencies = [
139
+ "cfg-if",
140
+ "windows-link",
141
+ ]
142
+
143
+ [[package]]
144
+ name = "magnus"
145
+ version = "0.9.3"
146
+ source = "registry+https://github.com/rust-lang/crates.io-index"
147
+ checksum = "40ef424404d166cbb71c8b8d19c9c589c748c4547c1afa1928c5504299f6c713"
148
+ dependencies = [
149
+ "bytes",
150
+ "magnus-macros",
151
+ "rb-sys",
152
+ "rb-sys-env",
153
+ "seq-macro",
154
+ ]
155
+
156
+ [[package]]
157
+ name = "magnus-macros"
158
+ version = "0.9.1"
159
+ source = "registry+https://github.com/rust-lang/crates.io-index"
160
+ checksum = "9dafde2eeb66f090e0f326112323eb8324b12cb32b5d1210e541d3df6b0ce77e"
161
+ dependencies = [
162
+ "proc-macro2",
163
+ "quote",
164
+ "syn 2.0.119",
165
+ ]
166
+
167
+ [[package]]
168
+ name = "matryona-machines"
169
+ version = "0.5.0"
170
+ source = "registry+https://github.com/rust-lang/crates.io-index"
171
+ checksum = "e448feeedb05fc14a41811dbbe56b1189c2ba1e4a46ae3a16b7f43e68810cc5d"
172
+ dependencies = [
173
+ "magnus",
174
+ ]
175
+
176
+ [[package]]
177
+ name = "memchr"
178
+ version = "2.8.3"
179
+ source = "registry+https://github.com/rust-lang/crates.io-index"
180
+ checksum = "cf8baf1c55e62ffcace7a9f06f4bd9cd3f0c4beb022d3b367256b91b87513d98"
181
+
182
+ [[package]]
183
+ name = "minimal-lexical"
184
+ version = "0.2.1"
185
+ source = "registry+https://github.com/rust-lang/crates.io-index"
186
+ checksum = "68354c5c6bd36d73ff3feceb05efa59b6acb7626617f4962be322a825e61f79a"
187
+
188
+ [[package]]
189
+ name = "nom"
190
+ version = "7.1.3"
191
+ source = "registry+https://github.com/rust-lang/crates.io-index"
192
+ checksum = "d273983c5a657a70a3e8f2a01329822f3b8c8172b73826411a55751e404a0a4a"
193
+ dependencies = [
194
+ "memchr",
195
+ "minimal-lexical",
196
+ ]
197
+
198
+ [[package]]
199
+ name = "pin-project-lite"
200
+ version = "0.2.17"
201
+ source = "registry+https://github.com/rust-lang/crates.io-index"
202
+ checksum = "a89322df9ebe1c1578d689c92318e070967d1042b512afbe49518723f4e6d5cd"
203
+
204
+ [[package]]
205
+ name = "proc-macro2"
206
+ version = "1.0.107"
207
+ source = "registry+https://github.com/rust-lang/crates.io-index"
208
+ checksum = "985e7ec9bb745e6ce6535b544d84d6cd6f7ad8bd711c398938ae983b91a766d9"
209
+ dependencies = [
210
+ "unicode-ident",
211
+ ]
212
+
213
+ [[package]]
214
+ name = "quote"
215
+ version = "1.0.47"
216
+ source = "registry+https://github.com/rust-lang/crates.io-index"
217
+ checksum = "1fbf4db142a473a8d80c26bbf18454ed458bf8d26c8219c331daecfdbd079001"
218
+ dependencies = [
219
+ "proc-macro2",
220
+ ]
221
+
222
+ [[package]]
223
+ name = "rb-sys"
224
+ version = "0.9.130"
225
+ source = "registry+https://github.com/rust-lang/crates.io-index"
226
+ checksum = "02faf625bb10ba893e3ae620f19c9fb1b5f8fcae0fe4eb86bb3f2230fad75edb"
227
+ dependencies = [
228
+ "rb-sys-build",
229
+ ]
230
+
231
+ [[package]]
232
+ name = "rb-sys-build"
233
+ version = "0.9.130"
234
+ source = "registry+https://github.com/rust-lang/crates.io-index"
235
+ checksum = "05be6f9c86fe5482808162826f6c047d093b3670582296c770de1d94f8066694"
236
+ dependencies = [
237
+ "bindgen",
238
+ "lazy_static",
239
+ "proc-macro2",
240
+ "quote",
241
+ "regex",
242
+ "shell-words",
243
+ "syn 2.0.119",
244
+ ]
245
+
246
+ [[package]]
247
+ name = "rb-sys-env"
248
+ version = "0.2.3"
249
+ source = "registry+https://github.com/rust-lang/crates.io-index"
250
+ checksum = "cca7ad6a7e21e72151d56fe2495a259b5670e204c3adac41ee7ef676ea08117a"
251
+
252
+ [[package]]
253
+ name = "regex"
254
+ version = "1.13.1"
255
+ source = "registry+https://github.com/rust-lang/crates.io-index"
256
+ checksum = "f020237b6c8eed93db2e2cb53c00c60a8e1bc73da7d073199a1180401450218d"
257
+ dependencies = [
258
+ "aho-corasick",
259
+ "memchr",
260
+ "regex-automata",
261
+ "regex-syntax",
262
+ ]
263
+
264
+ [[package]]
265
+ name = "regex-automata"
266
+ version = "0.4.18"
267
+ source = "registry+https://github.com/rust-lang/crates.io-index"
268
+ checksum = "ad8553b9b26413251cbf30e620595c7a41b3887f03da04579c0e6b0d6a06b4b2"
269
+ dependencies = [
270
+ "aho-corasick",
271
+ "memchr",
272
+ "regex-syntax",
273
+ ]
274
+
275
+ [[package]]
276
+ name = "regex-syntax"
277
+ version = "0.8.11"
278
+ source = "registry+https://github.com/rust-lang/crates.io-index"
279
+ checksum = "d6f6ff9a378485b298a5286656da665ba74413d36db0979633275d2e708145d4"
280
+
281
+ [[package]]
282
+ name = "rustc-hash"
283
+ version = "2.1.3"
284
+ source = "registry+https://github.com/rust-lang/crates.io-index"
285
+ checksum = "6b1e7f9a428571be2dc5bc0505c13fb6bf936822b894ec87abf8a08a4e51742d"
286
+
287
+ [[package]]
288
+ name = "seq-macro"
289
+ version = "0.3.6"
290
+ source = "registry+https://github.com/rust-lang/crates.io-index"
291
+ checksum = "1bc711410fbe7399f390ca1c3b60ad0f53f80e95c5eb935e52268a0e2cd49acc"
292
+
293
+ [[package]]
294
+ name = "shell-words"
295
+ version = "1.1.1"
296
+ source = "registry+https://github.com/rust-lang/crates.io-index"
297
+ checksum = "dc6fe69c597f9c37bfeeeeeb33da3530379845f10be461a66d16d03eca2ded77"
298
+
299
+ [[package]]
300
+ name = "shlex"
301
+ version = "1.3.0"
302
+ source = "registry+https://github.com/rust-lang/crates.io-index"
303
+ checksum = "0fda2ff0d084019ba4d7c6f371c95d8fd75ce3524c3cb8fb653a3023f6323e64"
304
+
305
+ [[package]]
306
+ name = "syn"
307
+ version = "2.0.119"
308
+ source = "registry+https://github.com/rust-lang/crates.io-index"
309
+ checksum = "872831b642d1a07999a962a351ed35b955ea2cfc8f3862091e2a240a84f17297"
310
+ dependencies = [
311
+ "proc-macro2",
312
+ "quote",
313
+ "unicode-ident",
314
+ ]
315
+
316
+ [[package]]
317
+ name = "syn"
318
+ version = "3.0.9"
319
+ source = "registry+https://github.com/rust-lang/crates.io-index"
320
+ checksum = "d78c8dee4c7bf0e14673097256fed6142ce9d3b85a408189d07482442145823b"
321
+ dependencies = [
322
+ "proc-macro2",
323
+ "quote",
324
+ "unicode-ident",
325
+ ]
326
+
327
+ [[package]]
328
+ name = "tokio"
329
+ version = "1.54.1"
330
+ source = "registry+https://github.com/rust-lang/crates.io-index"
331
+ checksum = "b52fd3255258d26fac7264ab5a76b53c13367136dc011d3d6ad4f8ed070396a3"
332
+ dependencies = [
333
+ "pin-project-lite",
334
+ "tokio-macros",
335
+ ]
336
+
337
+ [[package]]
338
+ name = "tokio-macros"
339
+ version = "2.7.2"
340
+ source = "registry+https://github.com/rust-lang/crates.io-index"
341
+ checksum = "78773a2a397f451582ce068015985c33193cf6dea8b74d2a639fe457b2f07b0e"
342
+ dependencies = [
343
+ "proc-macro2",
344
+ "quote",
345
+ "syn 3.0.9",
346
+ ]
347
+
348
+ [[package]]
349
+ name = "tokio-util"
350
+ version = "0.7.20"
351
+ source = "registry+https://github.com/rust-lang/crates.io-index"
352
+ checksum = "e464cf451ba96ebfc6f9b6542f17ee8b8956e33f1e40d9690624e59d7a7f8a4b"
353
+ dependencies = [
354
+ "bytes",
355
+ "futures-core",
356
+ "futures-sink",
357
+ "pin-project-lite",
358
+ "tokio",
359
+ ]
360
+
361
+ [[package]]
362
+ name = "unicode-ident"
363
+ version = "1.0.27"
364
+ source = "registry+https://github.com/rust-lang/crates.io-index"
365
+ checksum = "a2c754d6c33795a1c324727428e5a7dedb5b06195f9890bdbcba760d3e246563"
366
+
367
+ [[package]]
368
+ name = "windows-link"
369
+ version = "0.2.1"
370
+ source = "registry+https://github.com/rust-lang/crates.io-index"
371
+ checksum = "f0805222e57f7521d6a62e36fa9163bc891acd422f971defe97d64e70d0a4fe5"
data/Cargo.toml CHANGED
@@ -1,17 +1,28 @@
1
1
  [workspace]
2
- members = ["ext/deadline_machines_native/core"]
2
+ members = ["ext/deadline_machines_native/core", "ext/deadline_machines_native/ffi"]
3
+ default-members = ["ext/deadline_machines_native/core"]
3
4
  resolver = "3"
4
5
 
5
6
  [workspace.package]
6
7
  edition = "2024"
7
8
  rust-version = "1.99"
9
+ license = "MIT"
8
10
 
9
11
  [workspace.dependencies]
10
12
  deadline-machines = { path = "ext/deadline_machines_native/core" }
13
+ matryona-machines = { version = ">=0.5", default-features = false }
14
+ magnus = { version = "0.9.3", default-features = false }
15
+ # Nothing here calls rb-sys directly: this is the compiled fallback that
16
+ # implements the stable API for a Ruby rb-sys has no pre-generated bindings
17
+ # for, such as a preview. magnus asks for "stable-api" without it, and
18
+ # default-features = false drops the default that would have supplied it, so
19
+ # removing this line breaks the build on every future Ruby.
20
+ rb-sys = { version = "0.9.130", default-features = false, features = ["stable-api-compiled-fallback"] }
11
21
 
12
22
  [workspace.lints.rust]
13
23
  unsafe_code = "forbid"
14
24
  unused_must_use = "warn"
25
+ missing_docs = "warn"
15
26
 
16
27
  [workspace.lints.clippy]
17
28
  all = { level = "warn", priority = -1 }
data/README.md CHANGED
@@ -20,31 +20,42 @@ navigates by.
20
20
  gem 'deadline_machines'
21
21
  ```
22
22
 
23
- Requires **Ruby 4.0+**. Nothing else: no Rust toolchain, no platform gem, no
24
- compiled extension.
23
+ Requires **Ruby 4.0+**. The budget arithmetic is native: platform gems ship
24
+ precompiled for macOS and Linux, and a source install builds the extension
25
+ with a Rust toolchain.
25
26
 
26
27
  ---
27
28
 
28
29
  ## 🎯 Mission Brief
29
30
 
31
+ Every instant and span is **Integer nanoseconds**, as
32
+ `Process.clock_gettime(Process::CLOCK_MONOTONIC, :nanosecond)` reads them.
33
+
30
34
  ```ruby
31
- DeadlineMachines.with_deadline(5) do |request|
32
- request.remaining # => 5.0
35
+ SECOND = 1_000_000_000
36
+
37
+ DeadlineMachines.with_deadline(5 * SECOND) do |request|
38
+ request.remaining # => 5_000_000_000
33
39
 
34
- request.derive(1) do |attempt|
35
- attempt.remaining # => 1.0
40
+ request.derive(SECOND) do |attempt|
41
+ attempt.remaining # => 1_000_000_000
42
+ attempt.check # => nil, or :exceeded / :cancelled
36
43
  attempt.check! # raises DeadlineMachines::Exceeded when spent
37
44
  end
38
45
 
39
- DeadlineMachines.with_deadline(60) do
40
- DeadlineMachines.remaining # => 5.0, a nested scope cannot widen the budget
46
+ DeadlineMachines.with_deadline(60 * SECOND) do
47
+ DeadlineMachines.remaining # => 5_000_000_000, a nested scope cannot widen the budget
41
48
  end
42
49
 
43
- request.cancel('client hung up')
50
+ request.cancel('client hung up') # => :propagated (:already_cancelled on a repeat)
44
51
  DeadlineMachines.check! # raises DeadlineMachines::Cancelled
45
52
  end
46
53
  ```
47
54
 
55
+ The yielded object is a `Scope`: a frozen `Deadline` value plus a
56
+ `CancelToken`, read against `DeadlineMachines.clock`. `remaining` is `nil`
57
+ when there is no limit.
58
+
48
59
  ---
49
60
 
50
61
  ## 🛰️ Why the Fleet Needs It
@@ -54,7 +65,7 @@ request the caller abandoned twenty-eight seconds ago. `clamp_sleep` is the hook
54
65
  that stops it:
55
66
 
56
67
  ```ruby
57
- delay = deadline.clamp_sleep(backoff.next_delay) # never overruns what is left
68
+ delay = scope.clamp_sleep(backoff.next_delay_ns) # never overruns what is left
58
69
  ```
59
70
 
60
71
  `DeadlineMachines.current` is fiber-scoped, so `Async` tasks inherit the ambient
@@ -70,32 +81,48 @@ Inject `TestClock` and the whole family becomes deterministic:
70
81
  ```ruby
71
82
  clock = DeadlineMachines::TestClock.new
72
83
  DeadlineMachines.clock = clock
73
- deadline = DeadlineMachines::Deadline.after(1)
74
- clock.advance(2)
75
- deadline.expired? # => true
84
+ scope = DeadlineMachines::Scope.new(DeadlineMachines::Deadline.after(clock.now_ns, 1_000))
85
+ clock.advance(2_000)
86
+ scope.expired? # => true
76
87
  ```
77
88
 
89
+ `Deadline` itself holds no clock and mirrors the Rust core, `now` first:
90
+
91
+ ```ruby
92
+ deadline = DeadlineMachines::Deadline.after(0, 100)
93
+ deadline.remaining(40) # => 60
94
+ deadline.check(100) # => :exceeded
95
+ deadline.clamp_sleep(80, 30) # => 20
96
+ deadline.tighten(DeadlineMachines::Deadline.never) # => the same deadline
97
+ deadline.extend_by(50) # the core's `extend`, renamed past Object#extend
98
+ ```
99
+
100
+ A `Deadline` is valid or does not exist: `expires_at` is `nil` or an Integer
101
+ in the core's `Duration` range, checked natively whether the gem built it or
102
+ you did. TypeError for the wrong type, RangeError out of range.
103
+
78
104
  ---
79
105
 
80
106
  ## 🔻 Cancellation Runs Down the Chain of Command
81
107
 
82
108
  Cancellation flows down a tree and never up. A child derived after its parent was
83
- cancelled is already cancelled. `on_cancel` fires once, and a callback registered
84
- on an already-cancelled deadline fires immediately. The block form of `derive`
85
- unlinks the child on exit, so a long-lived parent does not accumulate children.
109
+ cancelled is already cancelled, and cancelling it answers `:already_cancelled`
110
+ and changes nothing, its reason included. `on_cancel` fires once, and a callback
111
+ registered on an already-cancelled scope fires immediately. The block forms of
112
+ `derive` and `child` unlink the child on exit, so a long-lived parent does not
113
+ accumulate children. `tighten` and `extend_by` return a scope sharing the same
114
+ token.
86
115
 
87
116
  ---
88
117
 
89
- ## 🔩 The Rust Core, and Why No Extension
90
-
91
- The same arithmetic and cancellation tree ships as the `deadline-machines` crate
92
- under `ext/deadline_machines_native/core`, `no_std` with zero dependencies and
93
- verified on bare metal. `Scope` there is the peer of `Deadline` here: a budget
94
- and a cancellation handle as one value.
118
+ ## 🔩 The Rust Core
95
119
 
96
- The gem itself is pure Ruby. Reading a monotonic clock is already a vDSO read,
97
- so there is nothing here worth a native extension. The crate is there for Rust
98
- consumers, not for this gem's install.
120
+ The arithmetic ships as the `deadline-machines` crate under
121
+ `ext/deadline_machines_native/core`: `no_std`, `Deadline` allocation-free with
122
+ zero dependencies, verified on bare metal. Every `Deadline` operation in this
123
+ gem goes through it. `CancelToken` and `Scope` there (feature `alloc`) are the
124
+ peers of the Ruby classes of the same names; the Ruby ones stay in Ruby
125
+ because they hold Ruby observers, reasons and fiber-bound state.
99
126
 
100
127
  ---
101
128
 
@@ -0,0 +1,44 @@
1
+ # Changelog
2
+
3
+ ## [0.5.0](https://github.com/seuros/deadline_machines/compare/deadline-machines-v0.4.0...deadline-machines-v0.5.0) (2026-11-16)
4
+
5
+
6
+ ### ⚠ BREAKING CHANGES
7
+
8
+ * split Deadline into a native Data value, Scope and CancelToken
9
+
10
+ ### Features
11
+
12
+ * split Deadline into a native Data value, Scope and CancelToken ([9a4a4ad](https://github.com/seuros/deadline_machines/commit/9a4a4ad1f51feef7fd88d55b1419eee5e93cf5ff))
13
+
14
+ ## [0.4.0](https://github.com/seuros/deadline_machines/compare/deadline-machines-v0.3.0...deadline-machines-v0.4.0) (2026-11-06)
15
+
16
+
17
+ ### Features
18
+
19
+ * await cancellation and bridge to tokio-util tokens ([72118dc](https://github.com/seuros/deadline_machines/commit/72118dc316a4281f9fbcbb82c536e72b35cac0c2))
20
+
21
+
22
+ ### Bug Fixes
23
+
24
+ * keep test modules out of the packaged crate ([2719800](https://github.com/seuros/deadline_machines/commit/27198003e6883be4eab975c15cd0a3e14614d808))
25
+
26
+ ## [0.3.0](https://github.com/seuros/deadline_machines/compare/deadline-machines-v0.2.0...deadline-machines-v0.3.0) (2026-11-03)
27
+
28
+
29
+ ### Features
30
+
31
+ * add optional Tokio deadline adapter ([6a36628](https://github.com/seuros/deadline_machines/commit/6a366288d4738f99affc172c62e6c49ca5caae37))
32
+
33
+ ## [0.2.0](https://github.com/seuros/deadline_machines/compare/deadline-machines-v0.1.0...deadline-machines-v0.2.0) (2026-11-01)
34
+
35
+
36
+ ### Features
37
+
38
+ * **core:** add Scope, RBS signatures, release config and CI ([24018c3](https://github.com/seuros/deadline_machines/commit/24018c39edcb12634f92057d699e1f2ad936ad4a))
39
+ * deadline propagation and cooperative cancellation ([9858496](https://github.com/seuros/deadline_machines/commit/9858496f48cc0eca1edf8df613f9974fa15abba2))
40
+
41
+
42
+ ### Bug Fixes
43
+
44
+ * ship the core's test files so the packaged crate builds ([0340bc6](https://github.com/seuros/deadline_machines/commit/0340bc6ec958cb1983212f4cd0b9943cc36aef5c))
@@ -1,25 +1,28 @@
1
1
  [package]
2
2
  name = "deadline-machines"
3
- version = "0.4.0"
3
+ version = "0.5.0"
4
4
  edition.workspace = true
5
5
  rust-version.workspace = true
6
6
  authors = ["Abdelkader Boudih <oss@seuros.com>"]
7
- license = "MIT"
8
- description = "Monotonic deadline arithmetic and cooperative cancellation trees - no_std, zero dependencies"
7
+ license.workspace = true
8
+ description = "Monotonic deadline arithmetic and cooperative cancellation trees - no_std, allocation-free deadlines"
9
9
  repository = "https://github.com/seuros/deadline_machines"
10
10
  keywords = ["deadline", "timeout", "cancellation", "resilience", "no-std"]
11
11
  categories = ["no-std", "concurrency"]
12
12
  readme = "README.md"
13
- exclude = ["src/**/tests.rs", "tests/"]
13
+ exclude = ["src/**/tests.rs", "src/tests/", "tests/"]
14
+
14
15
  [lib]
15
16
  name = "deadline_machines"
16
17
  crate-type = ["lib"]
17
18
 
18
19
  [features]
19
- default = ["std"]
20
- std = ["alloc"]
20
+ default = []
21
+ # `CancelToken` and `Scope`: cancellation shared through `Arc`.
21
22
  alloc = []
22
- tokio = ["std", "dep:tokio"]
23
+ # A Tokio clock, timeouts and a cancel-safe `cancelled()` future.
24
+ tokio = ["alloc", "dep:tokio"]
25
+ # Bridges `CancelToken` both ways with `tokio_util::sync::CancellationToken`.
23
26
  tokio-util = ["tokio", "dep:tokio-util"]
24
27
 
25
28
  [dependencies]