Skip to content

Commit c3bcc5c

Browse files
committed
use fork of regex, implement captures_iter
1 parent 39dae98 commit c3bcc5c

File tree

3 files changed

+10
-5
lines changed

3 files changed

+10
-5
lines changed

Cargo.lock

Lines changed: 2 additions & 4 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,4 +11,4 @@ crate-type = ["cdylib"]
1111
[dependencies]
1212
ouroboros = "0.15.6"
1313
pyo3 = "0.18.1"
14-
regex = "1.7.3"
14+
regex = { git = "https://github.com/circuitsacul/regex-adopt" }

src/regex.rs

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -104,6 +104,13 @@ impl Regex {
104104
Captures::try_new(Arc::new(text), |text| self.0.captures(text).ok_or(())).ok()
105105
}
106106

107+
pub fn captures_iter(&self, text: String) -> Vec<Captures> {
108+
let text = Arc::new(text);
109+
self.0.captures_iter(&text)
110+
.map(|caps| Captures::new(text.clone(), |text| caps.adopt(text)))
111+
.collect()
112+
}
113+
107114
#[pyo3(signature = (text, limit=None))]
108115
pub fn split(&self, text: &str, limit: Option<usize>) -> Vec<String> {
109116
if let Some(limit) = limit {

0 commit comments

Comments
 (0)