ahocorasick-rust 2.2.0-x86_64-linux-gnu
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 +7 -0
- data/README.md +255 -0
- data/Rakefile +33 -0
- data/docs/match_kind.md +139 -0
- data/docs/reference.md +396 -0
- data/ext/rahocorasick/Cargo.lock +304 -0
- data/ext/rahocorasick/Cargo.toml +13 -0
- data/ext/rahocorasick/extconf.rb +6 -0
- data/ext/rahocorasick/src/lib.rs +191 -0
- data/lib/ahocorasick-rust.rb +9 -0
- data/lib/rahocorasick/2.7/rahocorasick.so +0 -0
- data/lib/rahocorasick/3.0/rahocorasick.so +0 -0
- data/lib/rahocorasick/3.1/rahocorasick.so +0 -0
- data/lib/rahocorasick/3.2/rahocorasick.so +0 -0
- data/lib/rahocorasick/3.3/rahocorasick.so +0 -0
- data/lib/rahocorasick/3.4/rahocorasick.so +0 -0
- metadata +79 -0
data/docs/reference.md
ADDED
|
@@ -0,0 +1,396 @@
|
|
|
1
|
+
# API Reference
|
|
2
|
+
|
|
3
|
+
Complete reference for all methods and options in the `ahocorasick-rust` gem.
|
|
4
|
+
|
|
5
|
+
## Table of Contents
|
|
6
|
+
|
|
7
|
+
- [Constructor](#constructor)
|
|
8
|
+
- [Search Methods](#search-methods)
|
|
9
|
+
- [Replace Methods](#replace-methods)
|
|
10
|
+
|
|
11
|
+
---
|
|
12
|
+
|
|
13
|
+
## Constructor
|
|
14
|
+
|
|
15
|
+
### `AhoCorasickRust.new(patterns, **options)`
|
|
16
|
+
|
|
17
|
+
Creates a new Aho-Corasick matcher from an array of pattern strings.
|
|
18
|
+
|
|
19
|
+
**Parameters:**
|
|
20
|
+
- `patterns` (Array<String>) - Array of pattern strings to search for
|
|
21
|
+
- `options` (Hash) - Optional configuration
|
|
22
|
+
|
|
23
|
+
**Options:**
|
|
24
|
+
- `case_insensitive` (Boolean) - Enable ASCII case-insensitive matching (default: `false`)
|
|
25
|
+
- `match_kind` (Symbol) - Strategy for handling overlapping patterns (default: `:leftmost_first`)
|
|
26
|
+
- `:leftmost_first` - First pattern in list wins
|
|
27
|
+
- `:leftmost_longest` - Longest pattern wins
|
|
28
|
+
- `:standard` - Standard Aho-Corasick behavior
|
|
29
|
+
|
|
30
|
+
**Examples:**
|
|
31
|
+
|
|
32
|
+
```ruby
|
|
33
|
+
# Basic usage
|
|
34
|
+
matcher = AhoCorasickRust.new(['foo', 'bar', 'baz'])
|
|
35
|
+
|
|
36
|
+
# Case-insensitive matching
|
|
37
|
+
matcher = AhoCorasickRust.new(['Ruby', 'Python'], case_insensitive: true)
|
|
38
|
+
|
|
39
|
+
# Control match priority
|
|
40
|
+
matcher = AhoCorasickRust.new(['abc', 'abcd'], match_kind: :leftmost_longest)
|
|
41
|
+
|
|
42
|
+
# Combine options
|
|
43
|
+
matcher = AhoCorasickRust.new(
|
|
44
|
+
['test', 'testing'],
|
|
45
|
+
case_insensitive: true,
|
|
46
|
+
match_kind: :leftmost_longest
|
|
47
|
+
)
|
|
48
|
+
```
|
|
49
|
+
|
|
50
|
+
**Raises:**
|
|
51
|
+
- `TypeError` - If patterns is not an array or contains non-strings
|
|
52
|
+
- `ArgumentError` - If match_kind is invalid
|
|
53
|
+
- `RuntimeError` - If automaton construction fails
|
|
54
|
+
|
|
55
|
+
---
|
|
56
|
+
|
|
57
|
+
## Search Methods
|
|
58
|
+
|
|
59
|
+
### `#lookup(haystack)`
|
|
60
|
+
|
|
61
|
+
Finds all non-overlapping pattern matches in the haystack.
|
|
62
|
+
|
|
63
|
+
**Parameters:**
|
|
64
|
+
- `haystack` (String) - The text to search
|
|
65
|
+
|
|
66
|
+
**Returns:** Array<String> - Array of matched patterns
|
|
67
|
+
|
|
68
|
+
**Examples:**
|
|
69
|
+
|
|
70
|
+
```ruby
|
|
71
|
+
matcher = AhoCorasickRust.new(['foo', 'bar'])
|
|
72
|
+
|
|
73
|
+
matcher.lookup('foo and bar')
|
|
74
|
+
# => ['foo', 'bar']
|
|
75
|
+
|
|
76
|
+
matcher.lookup('hello world')
|
|
77
|
+
# => []
|
|
78
|
+
|
|
79
|
+
# Non-overlapping: finds 'abc' and stops
|
|
80
|
+
matcher = AhoCorasickRust.new(['abc', 'bcd'])
|
|
81
|
+
matcher.lookup('abcd')
|
|
82
|
+
# => ['abc']
|
|
83
|
+
```
|
|
84
|
+
|
|
85
|
+
---
|
|
86
|
+
|
|
87
|
+
### `#lookup_overlapping(haystack)`
|
|
88
|
+
|
|
89
|
+
Finds all pattern matches, including overlapping ones.
|
|
90
|
+
|
|
91
|
+
**Parameters:**
|
|
92
|
+
- `haystack` (String) - The text to search
|
|
93
|
+
|
|
94
|
+
**Returns:** Array<String> - Array of all matched patterns, including overlaps
|
|
95
|
+
|
|
96
|
+
**Examples:**
|
|
97
|
+
|
|
98
|
+
```ruby
|
|
99
|
+
matcher = AhoCorasickRust.new(['abc', 'bcd', 'cde'])
|
|
100
|
+
|
|
101
|
+
matcher.lookup_overlapping('abcde')
|
|
102
|
+
# => ['abc', 'bcd', 'cde']
|
|
103
|
+
|
|
104
|
+
# Compare with non-overlapping
|
|
105
|
+
matcher.lookup('abcde')
|
|
106
|
+
# => ['abc']
|
|
107
|
+
|
|
108
|
+
# Finds multiple occurrences of same pattern at different positions
|
|
109
|
+
matcher = AhoCorasickRust.new(['a', 'ab'])
|
|
110
|
+
matcher.lookup_overlapping('aab')
|
|
111
|
+
# => ['a', 'a', 'ab']
|
|
112
|
+
```
|
|
113
|
+
|
|
114
|
+
---
|
|
115
|
+
|
|
116
|
+
### `#lookup_with_positions(haystack)`
|
|
117
|
+
|
|
118
|
+
Finds all non-overlapping matches with their byte positions.
|
|
119
|
+
|
|
120
|
+
**Parameters:**
|
|
121
|
+
- `haystack` (String) - The text to search
|
|
122
|
+
|
|
123
|
+
**Returns:** Array<Hash> - Array of hashes with `:pattern`, `:start`, `:end` keys
|
|
124
|
+
|
|
125
|
+
**Examples:**
|
|
126
|
+
|
|
127
|
+
```ruby
|
|
128
|
+
matcher = AhoCorasickRust.new(['fox', 'dog'])
|
|
129
|
+
|
|
130
|
+
matcher.lookup_with_positions('The quick brown fox jumps over the lazy dog.')
|
|
131
|
+
# => [
|
|
132
|
+
# { pattern: 'fox', start: 16, end: 19 },
|
|
133
|
+
# { pattern: 'dog', start: 40, end: 43 }
|
|
134
|
+
# ]
|
|
135
|
+
|
|
136
|
+
matcher.lookup_with_positions('hello world')
|
|
137
|
+
# => []
|
|
138
|
+
|
|
139
|
+
# Positions are byte offsets, not character offsets
|
|
140
|
+
matcher = AhoCorasickRust.new(['数据'])
|
|
141
|
+
matcher.lookup_with_positions('金数据工具')
|
|
142
|
+
# => [{ pattern: '数据', start: 3, end: 9 }] # byte positions
|
|
143
|
+
```
|
|
144
|
+
|
|
145
|
+
---
|
|
146
|
+
|
|
147
|
+
### `#match?(haystack)`
|
|
148
|
+
|
|
149
|
+
Checks if any pattern matches in the haystack (predicate method).
|
|
150
|
+
|
|
151
|
+
**Parameters:**
|
|
152
|
+
- `haystack` (String) - The text to search
|
|
153
|
+
|
|
154
|
+
**Returns:** Boolean - `true` if any pattern matches, `false` otherwise
|
|
155
|
+
|
|
156
|
+
**Examples:**
|
|
157
|
+
|
|
158
|
+
```ruby
|
|
159
|
+
matcher = AhoCorasickRust.new(['foo', 'bar'])
|
|
160
|
+
|
|
161
|
+
matcher.match?('hello foo world')
|
|
162
|
+
# => true
|
|
163
|
+
|
|
164
|
+
matcher.match?('hello world')
|
|
165
|
+
# => false
|
|
166
|
+
|
|
167
|
+
# Works with case-insensitive
|
|
168
|
+
matcher = AhoCorasickRust.new(['Ruby'], case_insensitive: true)
|
|
169
|
+
matcher.match?('I love ruby')
|
|
170
|
+
# => true
|
|
171
|
+
```
|
|
172
|
+
|
|
173
|
+
---
|
|
174
|
+
|
|
175
|
+
### `#find_first(haystack)`
|
|
176
|
+
|
|
177
|
+
Returns the first pattern match found, or `nil` if no match.
|
|
178
|
+
|
|
179
|
+
**Parameters:**
|
|
180
|
+
- `haystack` (String) - The text to search
|
|
181
|
+
|
|
182
|
+
**Returns:** String or nil - First matched pattern, or `nil` if no match
|
|
183
|
+
|
|
184
|
+
**Examples:**
|
|
185
|
+
|
|
186
|
+
```ruby
|
|
187
|
+
matcher = AhoCorasickRust.new(['foo', 'bar', 'baz'])
|
|
188
|
+
|
|
189
|
+
matcher.find_first('hello foo bar baz')
|
|
190
|
+
# => 'foo'
|
|
191
|
+
|
|
192
|
+
matcher.find_first('hello world')
|
|
193
|
+
# => nil
|
|
194
|
+
|
|
195
|
+
# Stops after first match (more efficient than #lookup)
|
|
196
|
+
matcher = AhoCorasickRust.new(['cat', 'dog', 'bird'])
|
|
197
|
+
matcher.find_first('The cat and dog are friends')
|
|
198
|
+
# => 'cat' (stops, doesn't find 'dog')
|
|
199
|
+
```
|
|
200
|
+
|
|
201
|
+
---
|
|
202
|
+
|
|
203
|
+
### `#find_first_with_position(haystack)`
|
|
204
|
+
|
|
205
|
+
Returns the first pattern match with its position, or `nil` if no match.
|
|
206
|
+
|
|
207
|
+
**Parameters:**
|
|
208
|
+
- `haystack` (String) - The text to search
|
|
209
|
+
|
|
210
|
+
**Returns:** Hash or nil - Hash with `:pattern`, `:start`, `:end` keys, or `nil` if no match
|
|
211
|
+
|
|
212
|
+
**Examples:**
|
|
213
|
+
|
|
214
|
+
```ruby
|
|
215
|
+
matcher = AhoCorasickRust.new(['foo', 'bar'])
|
|
216
|
+
|
|
217
|
+
matcher.find_first_with_position('hello foo world')
|
|
218
|
+
# => { pattern: 'foo', start: 6, end: 9 }
|
|
219
|
+
|
|
220
|
+
matcher.find_first_with_position('hello world')
|
|
221
|
+
# => nil
|
|
222
|
+
|
|
223
|
+
# Finds earliest match in text, not first in pattern list
|
|
224
|
+
matcher = AhoCorasickRust.new(['bar', 'foo'])
|
|
225
|
+
matcher.find_first_with_position('foo bar baz')
|
|
226
|
+
# => { pattern: 'foo', start: 0, end: 3 } # 'foo' appears first in text
|
|
227
|
+
```
|
|
228
|
+
|
|
229
|
+
---
|
|
230
|
+
|
|
231
|
+
## Replace Methods
|
|
232
|
+
|
|
233
|
+
### `#replace_all(haystack, replacements)`
|
|
234
|
+
|
|
235
|
+
Replaces all pattern matches with their corresponding replacements.
|
|
236
|
+
|
|
237
|
+
**Parameters:**
|
|
238
|
+
- `haystack` (String) - The text to search
|
|
239
|
+
- `replacements` (Hash or Block) - Replacement mapping or block
|
|
240
|
+
|
|
241
|
+
**Returns:** String - New string with replacements applied
|
|
242
|
+
|
|
243
|
+
**Hash-based replacement:**
|
|
244
|
+
|
|
245
|
+
Maps pattern strings to their replacements. Patterns not in the hash remain unchanged.
|
|
246
|
+
|
|
247
|
+
```ruby
|
|
248
|
+
matcher = AhoCorasickRust.new(['foo', 'bar', 'baz'])
|
|
249
|
+
|
|
250
|
+
matcher.replace_all('foo and bar', { 'foo' => 'FOO', 'bar' => 'BAR' })
|
|
251
|
+
# => 'FOO and BAR'
|
|
252
|
+
|
|
253
|
+
# Partial replacement - 'baz' not in hash, stays unchanged
|
|
254
|
+
matcher.replace_all('foo bar baz', { 'foo' => 'hello' })
|
|
255
|
+
# => 'hello bar baz'
|
|
256
|
+
|
|
257
|
+
# Empty hash - no replacements
|
|
258
|
+
matcher.replace_all('foo and bar', {})
|
|
259
|
+
# => 'foo and bar'
|
|
260
|
+
```
|
|
261
|
+
|
|
262
|
+
**Block-based replacement:**
|
|
263
|
+
|
|
264
|
+
Passes each matched pattern to the block, uses return value as replacement.
|
|
265
|
+
|
|
266
|
+
```ruby
|
|
267
|
+
matcher = AhoCorasickRust.new(['foo', 'bar'])
|
|
268
|
+
|
|
269
|
+
matcher.replace_all('foo and bar') { |match| match.upcase }
|
|
270
|
+
# => 'FOO and BAR'
|
|
271
|
+
|
|
272
|
+
# Dynamic replacement logic
|
|
273
|
+
matcher = AhoCorasickRust.new(['apple', 'banana', 'cherry'])
|
|
274
|
+
text = 'I like apple, banana, and cherry'
|
|
275
|
+
result = matcher.replace_all(text) do |fruit|
|
|
276
|
+
{ 'apple' => '🍎', 'banana' => '🍌', 'cherry' => '🍒' }[fruit]
|
|
277
|
+
end
|
|
278
|
+
# => 'I like 🍎, 🍌, and 🍒'
|
|
279
|
+
|
|
280
|
+
# Replacement length can differ from match
|
|
281
|
+
matcher = AhoCorasickRust.new(['a', 'bb'])
|
|
282
|
+
matcher.replace_all('a bb a bb') { |m| m.length.to_s }
|
|
283
|
+
# => '1 2 1 2'
|
|
284
|
+
```
|
|
285
|
+
|
|
286
|
+
**Raises:**
|
|
287
|
+
- `ArgumentError` - If replacements is neither a Hash nor a block given
|
|
288
|
+
|
|
289
|
+
---
|
|
290
|
+
|
|
291
|
+
## Usage Patterns
|
|
292
|
+
|
|
293
|
+
### Content Filtering
|
|
294
|
+
|
|
295
|
+
```ruby
|
|
296
|
+
# Filter profanity with asterisks
|
|
297
|
+
bad_words = ['bad', 'worse', 'worst']
|
|
298
|
+
filter = AhoCorasickRust.new(bad_words, case_insensitive: true)
|
|
299
|
+
|
|
300
|
+
filter.replace_all('This is bad and worse') { |word| '*' * word.length }
|
|
301
|
+
# => 'This is *** and *****'
|
|
302
|
+
```
|
|
303
|
+
|
|
304
|
+
### Keyword Highlighting
|
|
305
|
+
|
|
306
|
+
```ruby
|
|
307
|
+
keywords = ['Ruby', 'Python', 'JavaScript']
|
|
308
|
+
matcher = AhoCorasickRust.new(keywords)
|
|
309
|
+
|
|
310
|
+
positions = matcher.lookup_with_positions('I love Ruby and Python')
|
|
311
|
+
# Use positions to add HTML tags, syntax highlighting, etc.
|
|
312
|
+
```
|
|
313
|
+
|
|
314
|
+
### Quick Existence Check
|
|
315
|
+
|
|
316
|
+
```ruby
|
|
317
|
+
# Check if any banned word appears
|
|
318
|
+
banned = ['spam', 'scam', 'fraud']
|
|
319
|
+
checker = AhoCorasickRust.new(banned, case_insensitive: true)
|
|
320
|
+
|
|
321
|
+
if checker.match?(user_input)
|
|
322
|
+
reject_message
|
|
323
|
+
end
|
|
324
|
+
```
|
|
325
|
+
|
|
326
|
+
### DNA Sequence Analysis
|
|
327
|
+
|
|
328
|
+
```ruby
|
|
329
|
+
# Find all overlapping genetic markers
|
|
330
|
+
markers = ['ATCG', 'TCGA', 'CGAT']
|
|
331
|
+
analyzer = AhoCorasickRust.new(markers)
|
|
332
|
+
|
|
333
|
+
sequence = 'ATCGAT'
|
|
334
|
+
analyzer.lookup_overlapping(sequence)
|
|
335
|
+
# => ['ATCG', 'TCGA', 'CGAT'] # all overlapping matches
|
|
336
|
+
```
|
|
337
|
+
|
|
338
|
+
### Tokenization
|
|
339
|
+
|
|
340
|
+
```ruby
|
|
341
|
+
# Prefer longest matches for tokens
|
|
342
|
+
keywords = ['if', 'iffy', 'then', 'end', 'endif']
|
|
343
|
+
tokenizer = AhoCorasickRust.new(keywords, match_kind: :leftmost_longest)
|
|
344
|
+
|
|
345
|
+
tokenizer.lookup('iffy then endif')
|
|
346
|
+
# => ['iffy', 'then', 'endif'] # chooses longer 'iffy' over 'if'
|
|
347
|
+
```
|
|
348
|
+
|
|
349
|
+
---
|
|
350
|
+
|
|
351
|
+
## Type Compatibility
|
|
352
|
+
|
|
353
|
+
### Accepted Types
|
|
354
|
+
|
|
355
|
+
- **Patterns:** Array of String objects
|
|
356
|
+
- **Haystack:** String objects
|
|
357
|
+
- **Options:** Symbol keys (`:case_insensitive`, `:match_kind`)
|
|
358
|
+
- **Replacements:** Hash with String keys/values, or Block returning String
|
|
359
|
+
|
|
360
|
+
### Unicode Support
|
|
361
|
+
|
|
362
|
+
All methods support UTF-8 encoded strings:
|
|
363
|
+
|
|
364
|
+
```ruby
|
|
365
|
+
matcher = AhoCorasickRust.new(['こんにちは', '世界'])
|
|
366
|
+
matcher.lookup('こんにちは世界')
|
|
367
|
+
# => ['こんにちは', '世界']
|
|
368
|
+
|
|
369
|
+
# Emoji support
|
|
370
|
+
matcher = AhoCorasickRust.new(['😊', '🎉'])
|
|
371
|
+
matcher.lookup('I am 😊 today 🎉')
|
|
372
|
+
# => ['😊', '🎉']
|
|
373
|
+
```
|
|
374
|
+
|
|
375
|
+
**Note:** Position values in `#lookup_with_positions` and `#find_first_with_position` are byte offsets, not character offsets. For multi-byte UTF-8 characters, byte positions will differ from character positions.
|
|
376
|
+
|
|
377
|
+
---
|
|
378
|
+
|
|
379
|
+
## Error Handling
|
|
380
|
+
|
|
381
|
+
```ruby
|
|
382
|
+
# TypeError: patterns must be array of strings
|
|
383
|
+
AhoCorasickRust.new('not an array')
|
|
384
|
+
# TypeError: wrong argument type String (expected Array)
|
|
385
|
+
|
|
386
|
+
AhoCorasickRust.new(['foo', 123])
|
|
387
|
+
# TypeError: wrong argument type Integer (expected String)
|
|
388
|
+
|
|
389
|
+
# ArgumentError: invalid match_kind
|
|
390
|
+
AhoCorasickRust.new(['foo'], match_kind: :invalid)
|
|
391
|
+
# ArgumentError: Invalid match_kind: 'invalid'...
|
|
392
|
+
|
|
393
|
+
# TypeError: haystack must be string
|
|
394
|
+
matcher.lookup(123)
|
|
395
|
+
# TypeError: wrong argument type Integer (expected String)
|
|
396
|
+
```
|
|
@@ -0,0 +1,304 @@
|
|
|
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 = "0.7.20"
|
|
8
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
9
|
+
checksum = "cc936419f96fa211c1b9166887b38e5e40b19958e5b895be7c1f93adec7071ac"
|
|
10
|
+
dependencies = [
|
|
11
|
+
"memchr",
|
|
12
|
+
]
|
|
13
|
+
|
|
14
|
+
[[package]]
|
|
15
|
+
name = "aho-corasick"
|
|
16
|
+
version = "1.1.4"
|
|
17
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
18
|
+
checksum = "ddd31a130427c27518df266943a5308ed92d4b226cc639f5a8f1002816174301"
|
|
19
|
+
dependencies = [
|
|
20
|
+
"memchr",
|
|
21
|
+
]
|
|
22
|
+
|
|
23
|
+
[[package]]
|
|
24
|
+
name = "bindgen"
|
|
25
|
+
version = "0.69.5"
|
|
26
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
27
|
+
checksum = "271383c67ccabffb7381723dea0672a673f292304fcb45c01cc648c7a8d58088"
|
|
28
|
+
dependencies = [
|
|
29
|
+
"bitflags",
|
|
30
|
+
"cexpr",
|
|
31
|
+
"clang-sys",
|
|
32
|
+
"itertools",
|
|
33
|
+
"lazy_static",
|
|
34
|
+
"lazycell",
|
|
35
|
+
"proc-macro2",
|
|
36
|
+
"quote",
|
|
37
|
+
"regex",
|
|
38
|
+
"rustc-hash",
|
|
39
|
+
"shlex",
|
|
40
|
+
"syn",
|
|
41
|
+
]
|
|
42
|
+
|
|
43
|
+
[[package]]
|
|
44
|
+
name = "bitflags"
|
|
45
|
+
version = "2.10.0"
|
|
46
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
47
|
+
checksum = "812e12b5285cc515a9c72a5c1d3b6d46a19dac5acfef5265968c166106e31dd3"
|
|
48
|
+
|
|
49
|
+
[[package]]
|
|
50
|
+
name = "cexpr"
|
|
51
|
+
version = "0.6.0"
|
|
52
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
53
|
+
checksum = "6fac387a98bb7c37292057cffc56d62ecb629900026402633ae9160df93a8766"
|
|
54
|
+
dependencies = [
|
|
55
|
+
"nom",
|
|
56
|
+
]
|
|
57
|
+
|
|
58
|
+
[[package]]
|
|
59
|
+
name = "cfg-if"
|
|
60
|
+
version = "1.0.0"
|
|
61
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
62
|
+
checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd"
|
|
63
|
+
|
|
64
|
+
[[package]]
|
|
65
|
+
name = "clang-sys"
|
|
66
|
+
version = "1.6.0"
|
|
67
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
68
|
+
checksum = "77ed9a53e5d4d9c573ae844bfac6872b159cb1d1585a83b29e7a64b7eef7332a"
|
|
69
|
+
dependencies = [
|
|
70
|
+
"glob",
|
|
71
|
+
"libc",
|
|
72
|
+
"libloading",
|
|
73
|
+
]
|
|
74
|
+
|
|
75
|
+
[[package]]
|
|
76
|
+
name = "either"
|
|
77
|
+
version = "1.15.0"
|
|
78
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
79
|
+
checksum = "48c757948c5ede0e46177b7add2e67155f70e33c07fea8284df6576da70b3719"
|
|
80
|
+
|
|
81
|
+
[[package]]
|
|
82
|
+
name = "glob"
|
|
83
|
+
version = "0.3.1"
|
|
84
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
85
|
+
checksum = "d2fabcfbdc87f4758337ca535fb41a6d701b65693ce38287d856d1674551ec9b"
|
|
86
|
+
|
|
87
|
+
[[package]]
|
|
88
|
+
name = "itertools"
|
|
89
|
+
version = "0.12.1"
|
|
90
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
91
|
+
checksum = "ba291022dbbd398a455acf126c1e341954079855bc60dfdda641363bd6922569"
|
|
92
|
+
dependencies = [
|
|
93
|
+
"either",
|
|
94
|
+
]
|
|
95
|
+
|
|
96
|
+
[[package]]
|
|
97
|
+
name = "lazy_static"
|
|
98
|
+
version = "1.4.0"
|
|
99
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
100
|
+
checksum = "e2abad23fbc42b3700f2f279844dc832adb2b2eb069b2df918f455c4e18cc646"
|
|
101
|
+
|
|
102
|
+
[[package]]
|
|
103
|
+
name = "lazycell"
|
|
104
|
+
version = "1.3.0"
|
|
105
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
106
|
+
checksum = "830d08ce1d1d941e6b30645f1a0eb5643013d835ce3779a5fc208261dbe10f55"
|
|
107
|
+
|
|
108
|
+
[[package]]
|
|
109
|
+
name = "libc"
|
|
110
|
+
version = "0.2.139"
|
|
111
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
112
|
+
checksum = "201de327520df007757c1f0adce6e827fe8562fbc28bfd9c15571c66ca1f5f79"
|
|
113
|
+
|
|
114
|
+
[[package]]
|
|
115
|
+
name = "libloading"
|
|
116
|
+
version = "0.7.4"
|
|
117
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
118
|
+
checksum = "b67380fd3b2fbe7527a606e18729d21c6f3951633d0500574c4dc22d2d638b9f"
|
|
119
|
+
dependencies = [
|
|
120
|
+
"cfg-if",
|
|
121
|
+
"winapi",
|
|
122
|
+
]
|
|
123
|
+
|
|
124
|
+
[[package]]
|
|
125
|
+
name = "magnus"
|
|
126
|
+
version = "0.8.2"
|
|
127
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
128
|
+
checksum = "3b36a5b126bbe97eb0d02d07acfeb327036c6319fd816139a49824a83b7f9012"
|
|
129
|
+
dependencies = [
|
|
130
|
+
"magnus-macros",
|
|
131
|
+
"rb-sys",
|
|
132
|
+
"rb-sys-env",
|
|
133
|
+
"seq-macro",
|
|
134
|
+
]
|
|
135
|
+
|
|
136
|
+
[[package]]
|
|
137
|
+
name = "magnus-macros"
|
|
138
|
+
version = "0.8.0"
|
|
139
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
140
|
+
checksum = "47607461fd8e1513cb4f2076c197d8092d921a1ea75bd08af97398f593751892"
|
|
141
|
+
dependencies = [
|
|
142
|
+
"proc-macro2",
|
|
143
|
+
"quote",
|
|
144
|
+
"syn",
|
|
145
|
+
]
|
|
146
|
+
|
|
147
|
+
[[package]]
|
|
148
|
+
name = "memchr"
|
|
149
|
+
version = "2.5.0"
|
|
150
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
151
|
+
checksum = "2dffe52ecf27772e601905b7522cb4ef790d2cc203488bbd0e2fe85fcb74566d"
|
|
152
|
+
|
|
153
|
+
[[package]]
|
|
154
|
+
name = "minimal-lexical"
|
|
155
|
+
version = "0.2.1"
|
|
156
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
157
|
+
checksum = "68354c5c6bd36d73ff3feceb05efa59b6acb7626617f4962be322a825e61f79a"
|
|
158
|
+
|
|
159
|
+
[[package]]
|
|
160
|
+
name = "nom"
|
|
161
|
+
version = "7.1.3"
|
|
162
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
163
|
+
checksum = "d273983c5a657a70a3e8f2a01329822f3b8c8172b73826411a55751e404a0a4a"
|
|
164
|
+
dependencies = [
|
|
165
|
+
"memchr",
|
|
166
|
+
"minimal-lexical",
|
|
167
|
+
]
|
|
168
|
+
|
|
169
|
+
[[package]]
|
|
170
|
+
name = "proc-macro2"
|
|
171
|
+
version = "1.0.103"
|
|
172
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
173
|
+
checksum = "5ee95bc4ef87b8d5ba32e8b7714ccc834865276eab0aed5c9958d00ec45f49e8"
|
|
174
|
+
dependencies = [
|
|
175
|
+
"unicode-ident",
|
|
176
|
+
]
|
|
177
|
+
|
|
178
|
+
[[package]]
|
|
179
|
+
name = "quote"
|
|
180
|
+
version = "1.0.42"
|
|
181
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
182
|
+
checksum = "a338cc41d27e6cc6dce6cefc13a0729dfbb81c262b1f519331575dd80ef3067f"
|
|
183
|
+
dependencies = [
|
|
184
|
+
"proc-macro2",
|
|
185
|
+
]
|
|
186
|
+
|
|
187
|
+
[[package]]
|
|
188
|
+
name = "rahocorasick"
|
|
189
|
+
version = "0.1.0"
|
|
190
|
+
dependencies = [
|
|
191
|
+
"aho-corasick 1.1.4",
|
|
192
|
+
"magnus",
|
|
193
|
+
"rb-sys",
|
|
194
|
+
]
|
|
195
|
+
|
|
196
|
+
[[package]]
|
|
197
|
+
name = "rb-sys"
|
|
198
|
+
version = "0.9.117"
|
|
199
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
200
|
+
checksum = "f900d1ce4629a2ebffaf5de74bd8f9c1188d4c5ed406df02f97e22f77a006f44"
|
|
201
|
+
dependencies = [
|
|
202
|
+
"rb-sys-build",
|
|
203
|
+
]
|
|
204
|
+
|
|
205
|
+
[[package]]
|
|
206
|
+
name = "rb-sys-build"
|
|
207
|
+
version = "0.9.117"
|
|
208
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
209
|
+
checksum = "ef1e9c857028f631056bcd6d88cec390c751e343ce2223ddb26d23eb4a151d59"
|
|
210
|
+
dependencies = [
|
|
211
|
+
"bindgen",
|
|
212
|
+
"lazy_static",
|
|
213
|
+
"proc-macro2",
|
|
214
|
+
"quote",
|
|
215
|
+
"regex",
|
|
216
|
+
"shell-words",
|
|
217
|
+
"syn",
|
|
218
|
+
]
|
|
219
|
+
|
|
220
|
+
[[package]]
|
|
221
|
+
name = "rb-sys-env"
|
|
222
|
+
version = "0.2.2"
|
|
223
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
224
|
+
checksum = "08f8d2924cf136a1315e2b4c7460a39f62ef11ee5d522df9b2750fab55b868b6"
|
|
225
|
+
|
|
226
|
+
[[package]]
|
|
227
|
+
name = "regex"
|
|
228
|
+
version = "1.7.1"
|
|
229
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
230
|
+
checksum = "48aaa5748ba571fb95cd2c85c09f629215d3a6ece942baa100950af03a34f733"
|
|
231
|
+
dependencies = [
|
|
232
|
+
"aho-corasick 0.7.20",
|
|
233
|
+
"memchr",
|
|
234
|
+
"regex-syntax",
|
|
235
|
+
]
|
|
236
|
+
|
|
237
|
+
[[package]]
|
|
238
|
+
name = "regex-syntax"
|
|
239
|
+
version = "0.6.28"
|
|
240
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
241
|
+
checksum = "456c603be3e8d448b072f410900c09faf164fbce2d480456f50eea6e25f9c848"
|
|
242
|
+
|
|
243
|
+
[[package]]
|
|
244
|
+
name = "rustc-hash"
|
|
245
|
+
version = "1.1.0"
|
|
246
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
247
|
+
checksum = "08d43f7aa6b08d49f382cde6a7982047c3426db949b1424bc4b7ec9ae12c6ce2"
|
|
248
|
+
|
|
249
|
+
[[package]]
|
|
250
|
+
name = "seq-macro"
|
|
251
|
+
version = "0.3.6"
|
|
252
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
253
|
+
checksum = "1bc711410fbe7399f390ca1c3b60ad0f53f80e95c5eb935e52268a0e2cd49acc"
|
|
254
|
+
|
|
255
|
+
[[package]]
|
|
256
|
+
name = "shell-words"
|
|
257
|
+
version = "1.1.0"
|
|
258
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
259
|
+
checksum = "24188a676b6ae68c3b2cb3a01be17fbf7240ce009799bb56d5b1409051e78fde"
|
|
260
|
+
|
|
261
|
+
[[package]]
|
|
262
|
+
name = "shlex"
|
|
263
|
+
version = "1.1.0"
|
|
264
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
265
|
+
checksum = "43b2853a4d09f215c24cc5489c992ce46052d359b5109343cbafbf26bc62f8a3"
|
|
266
|
+
|
|
267
|
+
[[package]]
|
|
268
|
+
name = "syn"
|
|
269
|
+
version = "2.0.110"
|
|
270
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
271
|
+
checksum = "a99801b5bd34ede4cf3fc688c5919368fea4e4814a4664359503e6015b280aea"
|
|
272
|
+
dependencies = [
|
|
273
|
+
"proc-macro2",
|
|
274
|
+
"quote",
|
|
275
|
+
"unicode-ident",
|
|
276
|
+
]
|
|
277
|
+
|
|
278
|
+
[[package]]
|
|
279
|
+
name = "unicode-ident"
|
|
280
|
+
version = "1.0.6"
|
|
281
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
282
|
+
checksum = "84a22b9f218b40614adcb3f4ff08b703773ad44fa9423e4e0d346d5db86e4ebc"
|
|
283
|
+
|
|
284
|
+
[[package]]
|
|
285
|
+
name = "winapi"
|
|
286
|
+
version = "0.3.9"
|
|
287
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
288
|
+
checksum = "5c839a674fcd7a98952e593242ea400abe93992746761e38641405d28b00f419"
|
|
289
|
+
dependencies = [
|
|
290
|
+
"winapi-i686-pc-windows-gnu",
|
|
291
|
+
"winapi-x86_64-pc-windows-gnu",
|
|
292
|
+
]
|
|
293
|
+
|
|
294
|
+
[[package]]
|
|
295
|
+
name = "winapi-i686-pc-windows-gnu"
|
|
296
|
+
version = "0.4.0"
|
|
297
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
298
|
+
checksum = "ac3b87c63620426dd9b991e5ce0329eff545bccbbb34f3be09ff6fb6ab51b7b6"
|
|
299
|
+
|
|
300
|
+
[[package]]
|
|
301
|
+
name = "winapi-x86_64-pc-windows-gnu"
|
|
302
|
+
version = "0.4.0"
|
|
303
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
304
|
+
checksum = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f"
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
[package]
|
|
2
|
+
edition = "2024"
|
|
3
|
+
name = "rahocorasick"
|
|
4
|
+
version = "0.1.0"
|
|
5
|
+
|
|
6
|
+
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
|
|
7
|
+
[lib]
|
|
8
|
+
crate-type = ["cdylib"]
|
|
9
|
+
|
|
10
|
+
[dependencies]
|
|
11
|
+
aho-corasick = "1.1"
|
|
12
|
+
magnus = "0.8"
|
|
13
|
+
rb-sys = { version = "0.9", features = ["stable-api-compiled-fallback"] }
|