lz4rip 0.1.1 → 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: 3c501bb8f4cd63f4f2d3d0ae5b75abcc7892b5a9fde08a419fc780f913435173
4
- data.tar.gz: 982c8bb12f228d7696b29bdc769e3838e2c667b8fc761eb245e813e720e4a826
3
+ metadata.gz: 2f66c12c967a06a207c9e8e742fac306280863bf655bd7b4318a2265d08c1cdf
4
+ data.tar.gz: be95ea7eb336509e7077737f0d4703dc500931f1608fdc2f52dc3b170904b16d
5
5
  SHA512:
6
- metadata.gz: 226311912ef4209023b7e1f2089c31ba41c6f63b9e7ebfd497c3fcf7bed1d362e729366148ebbd9adb73d32fc75747e7b16f8dee6e4738bb527fd68a9c1b4217
7
- data.tar.gz: d86295a8d164727cc8f12a6608078f66824dd6b557d418cac47bffbfd2d89fac5e883e2e27d7da92955c14f5f0679efb5d2231f72d7f1fa1320f0d05c28d6532
6
+ metadata.gz: 2fc02b8f797989ca99f23e97658dab9442c4fbb70ab03ff3436a73b5026b78d20c1bbf240e4febba0baed905863b225655f03c627d6db4ddee128224b419c82c
7
+ data.tar.gz: 92b2aa66f6282317c5b805f77cf47715288c8debc013520e5dffc78fb7d9c102f62f330906042b062b93aa2104ca21c5b1b0830edd87852b585f6451f4146efd
data/CHANGELOG.md CHANGED
@@ -2,6 +2,22 @@
2
2
 
3
3
  ## [Unreleased]
4
4
 
5
+ ## [0.2.0] - 2026-08-07
6
+
7
+ - Release the Ruby GVL around large frame/block compression and frame
8
+ decompression calls.
9
+ - Update the `lz4rip` crate dependency to 0.11.3.
10
+ - Replace Magnus with direct `rb-sys` bindings, add TruffleRuby build support,
11
+ and lower the Ruby requirement to 3.4.
12
+ - Add `max_decompressed_size:` to `Lz4rip::FrameCodec#decompress`, with the
13
+ cap enforced across concatenated frame output.
14
+ - Add RubyDoc metadata and move API reference details from `README.md` into
15
+ YARD comments.
16
+
17
+ ## [0.1.2] - 2026-08-05
18
+
19
+ - Update `lz4rip` crate dependency from 0.11.1 to 0.11.2.
20
+
5
21
  ## [0.1.1] - 2026-06-29
6
22
 
7
23
  - Update `lz4rip` crate dependency from 0.8 to 0.9.
data/Cargo.lock CHANGED
@@ -4,9 +4,9 @@ version = 4
4
4
 
5
5
  [[package]]
6
6
  name = "aho-corasick"
7
- version = "1.1.4"
7
+ version = "1.1.5"
8
8
  source = "registry+https://github.com/rust-lang/crates.io-index"
9
- checksum = "ddd31a130427c27518df266943a5308ed92d4b226cc639f5a8f1002816174301"
9
+ checksum = "c982642fa9e8606056828ee9a8505737230110bb1099153c79efe865c59d12ba"
10
10
  dependencies = [
11
11
  "memchr",
12
12
  ]
@@ -31,9 +31,9 @@ dependencies = [
31
31
 
32
32
  [[package]]
33
33
  name = "bitflags"
34
- version = "2.13.0"
34
+ version = "2.13.1"
35
35
  source = "registry+https://github.com/rust-lang/crates.io-index"
36
- checksum = "b4388bee8683e3d04af747c73422af53102d2bd24d9eadb6cbc100baef4b43f8"
36
+ checksum = "b588b76d00fde79687d7646a9b5bdf3cc0f655e0bbd080335a95d7e96f3587da"
37
37
 
38
38
  [[package]]
39
39
  name = "cexpr"
@@ -52,9 +52,9 @@ checksum = "9330f8b2ff13f34540b44e946ef35111825727b38d33286ef986142615121801"
52
52
 
53
53
  [[package]]
54
54
  name = "clang-sys"
55
- version = "1.8.1"
55
+ version = "1.9.1"
56
56
  source = "registry+https://github.com/rust-lang/crates.io-index"
57
- checksum = "0b023947811758c97c59bf9d1c188fd619ad4718dcaa767947df1cadb14f39f4"
57
+ checksum = "157a8ba7b480713b56f4c09fd13fc3e0a22a5dfab8097ba61cbc5feef950788a"
58
58
  dependencies = [
59
59
  "glob",
60
60
  "libc",
@@ -63,15 +63,15 @@ dependencies = [
63
63
 
64
64
  [[package]]
65
65
  name = "either"
66
- version = "1.16.0"
66
+ version = "1.17.0"
67
67
  source = "registry+https://github.com/rust-lang/crates.io-index"
68
- checksum = "91622ff5e7162018101f2fea40d6ebf4a78bbe5a49736a2020649edf9693679e"
68
+ checksum = "9e5e8f6c15a24b9a3ee5efec809ccd006d3b30e8b3bb63c39af737c7f87daa1d"
69
69
 
70
70
  [[package]]
71
71
  name = "glob"
72
- version = "0.3.3"
72
+ version = "0.3.4"
73
73
  source = "registry+https://github.com/rust-lang/crates.io-index"
74
- checksum = "0cc23270f6e1808e30a928bdc84dea0b9b4136a8bc82338574f23baf47bbd280"
74
+ checksum = "e4eba85ea1d0a966a983acd07deee566e67395d2d96b6fb39e62b5a833f1eb0b"
75
75
 
76
76
  [[package]]
77
77
  name = "itertools"
@@ -90,9 +90,9 @@ checksum = "bbd2bcb4c963f2ddae06a2efc7e9f3591312473c50c6685e1f298068316e66fe"
90
90
 
91
91
  [[package]]
92
92
  name = "libc"
93
- version = "0.2.186"
93
+ version = "0.2.189"
94
94
  source = "registry+https://github.com/rust-lang/crates.io-index"
95
- checksum = "68ab91017fe16c622486840e4c83c9a37afeff978bd239b5293d61ece587de66"
95
+ checksum = "3eaf3ede3fee6db1a4c2ee091bf8a8b4dccdc6d17f656fb07896ee72867612f2"
96
96
 
97
97
  [[package]]
98
98
  name = "libloading"
@@ -106,18 +106,17 @@ dependencies = [
106
106
 
107
107
  [[package]]
108
108
  name = "lz4rip"
109
- version = "0.1.1"
109
+ version = "0.1.2"
110
110
  dependencies = [
111
- "lz4rip 0.9.3",
112
- "magnus",
111
+ "lz4rip 0.11.3",
113
112
  "rb-sys",
114
113
  ]
115
114
 
116
115
  [[package]]
117
116
  name = "lz4rip"
118
- version = "0.9.3"
117
+ version = "0.11.3"
119
118
  source = "registry+https://github.com/rust-lang/crates.io-index"
120
- checksum = "b4c929eba0e2d2e97a3dc4193a476d36fd7c343ef0623b69394b8c69a437c1fa"
119
+ checksum = "55bde261679fd1d14bcae126094d7afb98c63c1a5018d0718741b658b686e950"
121
120
  dependencies = [
122
121
  "lz4rip-core",
123
122
  "lz4rip-decode",
@@ -127,56 +126,33 @@ dependencies = [
127
126
 
128
127
  [[package]]
129
128
  name = "lz4rip-core"
130
- version = "0.5.2"
129
+ version = "0.5.5"
131
130
  source = "registry+https://github.com/rust-lang/crates.io-index"
132
- checksum = "5bf2d77a9fc2acbfe6f4b6b0a3ef2d97f0c96bb384c4406225851a900f483788"
131
+ checksum = "22fc4edb61fcaf1cdad24ac2982eff7af4417ef463c33bcf5c42ba549abd8b96"
133
132
 
134
133
  [[package]]
135
134
  name = "lz4rip-decode"
136
- version = "0.9.0"
135
+ version = "0.10.3"
137
136
  source = "registry+https://github.com/rust-lang/crates.io-index"
138
- checksum = "a57fce948bb22f5f0e055a61dfb69a84b7b60e4afd54a6eadc1d26cd120241d9"
137
+ checksum = "60d65bfd4c032fefcf8c18fb5f8d9958f4925146845db16dbc9d416f1566b9bf"
139
138
  dependencies = [
140
139
  "lz4rip-core",
141
140
  ]
142
141
 
143
142
  [[package]]
144
143
  name = "lz4rip-encode"
145
- version = "0.9.2"
144
+ version = "0.10.5"
146
145
  source = "registry+https://github.com/rust-lang/crates.io-index"
147
- checksum = "e76796529ac165094cec92c7eb2fe993d26759552e319d78c58a4ac9d4a4bf89"
146
+ checksum = "09e92b7345788ec0d32b5e31051dc6a86730e17b01267e502e9ec2744b689d34"
148
147
  dependencies = [
149
148
  "lz4rip-core",
150
149
  ]
151
150
 
152
- [[package]]
153
- name = "magnus"
154
- version = "0.8.2"
155
- source = "registry+https://github.com/rust-lang/crates.io-index"
156
- checksum = "3b36a5b126bbe97eb0d02d07acfeb327036c6319fd816139a49824a83b7f9012"
157
- dependencies = [
158
- "magnus-macros",
159
- "rb-sys",
160
- "rb-sys-env",
161
- "seq-macro",
162
- ]
163
-
164
- [[package]]
165
- name = "magnus-macros"
166
- version = "0.8.0"
167
- source = "registry+https://github.com/rust-lang/crates.io-index"
168
- checksum = "47607461fd8e1513cb4f2076c197d8092d921a1ea75bd08af97398f593751892"
169
- dependencies = [
170
- "proc-macro2",
171
- "quote",
172
- "syn",
173
- ]
174
-
175
151
  [[package]]
176
152
  name = "memchr"
177
- version = "2.8.2"
153
+ version = "2.8.3"
178
154
  source = "registry+https://github.com/rust-lang/crates.io-index"
179
- checksum = "88904434abc2901f197fe8cc55f0445e7ded921dba5911dad2e2b39b48e663c4"
155
+ checksum = "cf8baf1c55e62ffcace7a9f06f4bd9cd3f0c4beb022d3b367256b91b87513d98"
180
156
 
181
157
  [[package]]
182
158
  name = "minimal-lexical"
@@ -196,18 +172,18 @@ dependencies = [
196
172
 
197
173
  [[package]]
198
174
  name = "proc-macro2"
199
- version = "1.0.106"
175
+ version = "1.0.107"
200
176
  source = "registry+https://github.com/rust-lang/crates.io-index"
201
- checksum = "8fd00f0bb2e90d81d1044c2b32617f68fcb9fa3bb7640c23e9c748e53fb30934"
177
+ checksum = "985e7ec9bb745e6ce6535b544d84d6cd6f7ad8bd711c398938ae983b91a766d9"
202
178
  dependencies = [
203
179
  "unicode-ident",
204
180
  ]
205
181
 
206
182
  [[package]]
207
183
  name = "quote"
208
- version = "1.0.46"
184
+ version = "1.0.47"
209
185
  source = "registry+https://github.com/rust-lang/crates.io-index"
210
- checksum = "dfbc457d0c7a0759a614551b11a6409e5951f6c7537be1f1b7682b9ae9230368"
186
+ checksum = "1fbf4db142a473a8d80c26bbf18454ed458bf8d26c8219c331daecfdbd079001"
211
187
  dependencies = [
212
188
  "proc-macro2",
213
189
  ]
@@ -236,17 +212,11 @@ dependencies = [
236
212
  "syn",
237
213
  ]
238
214
 
239
- [[package]]
240
- name = "rb-sys-env"
241
- version = "0.2.3"
242
- source = "registry+https://github.com/rust-lang/crates.io-index"
243
- checksum = "cca7ad6a7e21e72151d56fe2495a259b5670e204c3adac41ee7ef676ea08117a"
244
-
245
215
  [[package]]
246
216
  name = "regex"
247
- version = "1.12.4"
217
+ version = "1.13.1"
248
218
  source = "registry+https://github.com/rust-lang/crates.io-index"
249
- checksum = "f1292b7759ae1cb9ec195452d1390a074f0cd8541ab7a5a8c31cd6db45d4a6ba"
219
+ checksum = "f020237b6c8eed93db2e2cb53c00c60a8e1bc73da7d073199a1180401450218d"
250
220
  dependencies = [
251
221
  "aho-corasick",
252
222
  "memchr",
@@ -256,9 +226,9 @@ dependencies = [
256
226
 
257
227
  [[package]]
258
228
  name = "regex-automata"
259
- version = "0.4.14"
229
+ version = "0.4.18"
260
230
  source = "registry+https://github.com/rust-lang/crates.io-index"
261
- checksum = "6e1dd4122fc1595e8162618945476892eefca7b88c52820e74af6262213cae8f"
231
+ checksum = "ad8553b9b26413251cbf30e620595c7a41b3887f03da04579c0e6b0d6a06b4b2"
262
232
  dependencies = [
263
233
  "aho-corasick",
264
234
  "memchr",
@@ -273,15 +243,9 @@ checksum = "d6f6ff9a378485b298a5286656da665ba74413d36db0979633275d2e708145d4"
273
243
 
274
244
  [[package]]
275
245
  name = "rustc-hash"
276
- version = "2.1.2"
277
- source = "registry+https://github.com/rust-lang/crates.io-index"
278
- checksum = "94300abf3f1ae2e2b8ffb7b58043de3d399c73fa6f4b73826402a5c457614dbe"
279
-
280
- [[package]]
281
- name = "seq-macro"
282
- version = "0.3.6"
246
+ version = "2.1.3"
283
247
  source = "registry+https://github.com/rust-lang/crates.io-index"
284
- checksum = "1bc711410fbe7399f390ca1c3b60ad0f53f80e95c5eb935e52268a0e2cd49acc"
248
+ checksum = "6b1e7f9a428571be2dc5bc0505c13fb6bf936822b894ec87abf8a08a4e51742d"
285
249
 
286
250
  [[package]]
287
251
  name = "shell-words"
@@ -297,9 +261,9 @@ checksum = "0fda2ff0d084019ba4d7c6f371c95d8fd75ce3524c3cb8fb653a3023f6323e64"
297
261
 
298
262
  [[package]]
299
263
  name = "syn"
300
- version = "2.0.118"
264
+ version = "2.0.119"
301
265
  source = "registry+https://github.com/rust-lang/crates.io-index"
302
- checksum = "1b9ae57f904213ebb649ce6895b8a66c66f0203b9319718f69a5612a065b1422"
266
+ checksum = "872831b642d1a07999a962a351ed35b955ea2cfc8f3862091e2a240a84f17297"
303
267
  dependencies = [
304
268
  "proc-macro2",
305
269
  "quote",
@@ -308,9 +272,9 @@ dependencies = [
308
272
 
309
273
  [[package]]
310
274
  name = "twox-hash"
311
- version = "2.1.2"
275
+ version = "2.1.3"
312
276
  source = "registry+https://github.com/rust-lang/crates.io-index"
313
- checksum = "9ea3136b675547379c4bd395ca6b938e5ad3c3d20fad76e7fe85f9e0d011419c"
277
+ checksum = "8464ec13c3691491391d9fce00f6416c9a48e46972f72d7865688be2080192c9"
314
278
 
315
279
  [[package]]
316
280
  name = "unicode-ident"
data/README.md CHANGED
@@ -1,13 +1,13 @@
1
- # lz4rip Ractor-safe LZ4 for Ruby
1
+ # lz4rip: Ractor-safe LZ4 for Ruby
2
2
 
3
3
  [![CI](https://github.com/paddor/lz4rip-rb/actions/workflows/ci.yml/badge.svg)](https://github.com/paddor/lz4rip-rb/actions/workflows/ci.yml)
4
4
  [![Gem Version](https://img.shields.io/gem/v/lz4rip?color=e9573f)](https://rubygems.org/gems/lz4rip)
5
5
  [![License: MIT](https://img.shields.io/badge/License-MIT-blue.svg)](LICENSE)
6
- [![Ruby](https://img.shields.io/badge/Ruby-%3E%3D%204.0-CC342D?logo=ruby&logoColor=white)](https://www.ruby-lang.org)
6
+ [![Ruby](https://img.shields.io/badge/Ruby-%3E%3D%203.4-CC342D?logo=ruby&logoColor=white)](https://www.ruby-lang.org)
7
7
 
8
8
  Ruby bindings for [lz4rip](https://crates.io/crates/lz4rip), a pure-Rust LZ4
9
- implementation. Built with [magnus](https://github.com/matsadler/magnus) and
10
- declared Ractor-safe so you can compress from any Ractor without a global lock.
9
+ implementation. Built as an `rb-sys` native extension and declared Ractor-safe
10
+ so you can compress from any Ractor without a global lock.
11
11
 
12
12
  ## Features
13
13
 
@@ -20,7 +20,7 @@ declared Ractor-safe so you can compress from any Ractor without a global lock.
20
20
 
21
21
  ## Install
22
22
 
23
- Requires Ruby >= 4.0 and a Rust toolchain (for building the native extension):
23
+ Requires Ruby >= 3.4 and a Rust toolchain (for building the native extension):
24
24
 
25
25
  ```sh
26
26
  gem install lz4rip
@@ -42,6 +42,7 @@ require "lz4rip"
42
42
  codec = Lz4rip::FrameCodec.new
43
43
  compressed = codec.compress("hello world " * 1000)
44
44
  original = codec.decompress(compressed)
45
+ bounded = codec.decompress(compressed, max_decompressed_size: 12_000)
45
46
  ```
46
47
 
47
48
  ### Block codec (raw LZ4 blocks)
@@ -78,6 +79,9 @@ codec = Lz4rip::BlockCodec.new(dict: dict)
78
79
 
79
80
  ### Ractor safety
80
81
 
82
+ On Ruby VMs without Ractor support, the codecs still work normally; the
83
+ Ractor-specific guarantees and examples do not apply.
84
+
81
85
  ```ruby
82
86
  codec = Lz4rip::FrameCodec.new
83
87
 
@@ -93,35 +97,9 @@ end
93
97
  ractors.each { |r| p r.value } # => :ok, :ok, :ok, :ok
94
98
  ```
95
99
 
96
- ## API
97
-
98
- | Class / Module | Method | Description |
99
- |---|---|---|
100
- | `Lz4rip::FrameCodec` | `.new(dict: nil)` | Create a frame codec, optionally with a `Dictionary` or raw `String` dict |
101
- | | `#compress(string)` | Compress to LZ4 frame |
102
- | | `#decompress(string)` | Decompress an LZ4 frame |
103
- | | `#has_dict?` | Whether a dictionary is loaded |
104
- | | `#id` | Dictionary ID (nil without dict) |
105
- | | `#size` | Dictionary size in bytes (0 without dict) |
106
- | `Lz4rip::BlockCodec` | `.new(dict: nil)` | Create a block codec, optionally with a dict `String` |
107
- | | `#compress(string)` | Compress to raw LZ4 block |
108
- | | `#decompress(string, decompressed_size:)` | Decompress a raw LZ4 block |
109
- | | `#has_dict?` | Whether a dictionary is loaded |
110
- | | `#size` | Internal state size in bytes |
111
- | `Lz4rip::Dictionary` | `.new(bytes:, id: auto)` | Immutable dictionary value object |
112
- | | `#bytes` | Frozen binary dict bytes |
113
- | | `#id` | 32-bit dictionary ID |
114
- | | `#size` | Dictionary size in bytes |
115
- | `Lz4rip::DictTrainer` | `.new(max_dict_size)` | Create a trainer (capped at 65535) |
116
- | | `#add_sample(string)` | Feed a training sample |
117
- | | `#train` | Consume the trainer, return dict bytes |
118
- | | `#sample_count` | Number of accepted samples |
119
- | | `#total_bytes` | Total bytes of accepted samples |
120
- | | `#trained?` | Whether `#train` has been called |
121
- | | `#max_dict_size` | Configured max dict size |
122
- | `Lz4rip` | `.compress_bound(size)` | Max compressed output size for a given input size |
123
- | | `.block_stream_size` | Internal compressor heap size |
124
- | `Lz4rip::DecompressError` | | Raised on decompression failure (subclass of `StandardError`) |
100
+ ## Documentation
101
+
102
+ Reference: <https://rubydoc.info/gems/lz4rip>
125
103
 
126
104
  ## License
127
105
 
@@ -1,15 +1,15 @@
1
1
  [package]
2
2
  name = "lz4rip"
3
- version = "0.1.1"
3
+ version = "0.1.2"
4
4
  edition = "2021"
5
+ build = "build.rs"
5
6
 
6
7
  [lib]
7
8
  name = "lz4rip"
8
9
  crate-type = ["cdylib", "rlib"]
9
10
 
10
11
  [dependencies]
11
- lz4 = { version = "0.9", package = "lz4rip" }
12
- magnus = "0.8"
12
+ lz4 = { version = "0.11.3", package = "lz4rip" }
13
13
  rb-sys = "0.9"
14
14
 
15
15
  [build-dependencies]
@@ -0,0 +1,23 @@
1
+ use std::process::Command;
2
+
3
+ fn main() {
4
+ println!("cargo:rerun-if-env-changed=RUBY");
5
+ println!("cargo:rustc-check-cfg=cfg(ruby_engine, values(\"mri\", \"truffleruby\"))");
6
+
7
+ let ruby = std::env::var("RUBY").unwrap_or_else(|_| "ruby".to_string());
8
+ let output = Command::new(&ruby)
9
+ .arg("-rrbconfig")
10
+ .arg("-e")
11
+ .arg("print RbConfig::CONFIG.fetch('ruby_install_name')")
12
+ .output()
13
+ .unwrap_or_else(|err| panic!("failed to run {ruby}: {err}"));
14
+
15
+ if !output.status.success() {
16
+ panic!("failed to query Ruby engine with {ruby}");
17
+ }
18
+
19
+ match String::from_utf8_lossy(&output.stdout).trim() {
20
+ "truffleruby" => println!("cargo:rustc-cfg=ruby_engine=\"truffleruby\""),
21
+ _ => println!("cargo:rustc-cfg=ruby_engine=\"mri\""),
22
+ }
23
+ }