Skip to content

Commit 2dfe46c

Browse files
committed
upgrade deps; tag 0.0.4
1 parent 91419ea commit 2dfe46c

File tree

5 files changed

+111
-35
lines changed

5 files changed

+111
-35
lines changed

.github/workflows/check.yaml

Lines changed: 2 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -14,17 +14,9 @@ jobs:
1414
steps:
1515
- uses: actions/checkout@v4
1616

17-
- uses: supplypike/setup-bin@v3
17+
- uses: calcit-lang/setup-[email protected]
1818
with:
19-
uri: 'https://github.com/calcit-lang/calcit/releases/download/0.8.9/cr'
20-
name: 'cr'
21-
version: '0.8.9'
22-
23-
- uses: supplypike/setup-bin@v3
24-
with:
25-
uri: 'https://github.com/calcit-lang/calcit/releases/download/0.8.9/caps'
26-
name: 'caps'
27-
version: '0.8.9'
19+
version: "0.8.50"
2820

2921
- uses: dtolnay/rust-toolchain@stable
3022
with:

.rustfmt.toml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
2+
max_width = 136
3+
tab_spaces = 2

Cargo.lock

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

Cargo.toml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[package]
22
name = "calcit_regex"
3-
version = "0.0.2"
3+
version = "0.0.4"
44
authors = ["jiyinyiyong <[email protected]>"]
55
edition = "2021"
66

@@ -13,6 +13,6 @@ crate-type = ["dylib"] # Creates dynamic lib
1313
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
1414

1515
[dependencies]
16-
cirru_edn = "0.5.0"
17-
cirru_parser = "0.1.25"
18-
regex = "1.8.4"
16+
cirru_edn = "0.6.3"
17+
cirru_parser = "0.1.29"
18+
regex = "1.10.4"

src/lib.rs

Lines changed: 9 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
1-
use cirru_edn::Edn;
1+
use cirru_edn::{Edn, EdnListView};
22
use regex::Regex;
33

44
#[no_mangle]
55
pub fn abi_version() -> String {
6-
String::from("0.0.6")
6+
String::from("0.0.7")
77
}
88

99
#[no_mangle]
@@ -51,8 +51,8 @@ pub fn re_find(args: Vec<Edn>) -> Result<Edn, String> {
5151
Ok(p) => {
5252
let mut matched = p.find_iter(s);
5353
match matched.next() {
54-
Some(v) => Ok(Edn::Str(v.as_str().to_string().into_boxed_str())),
55-
None => Ok(Edn::Str("".to_owned().into_boxed_str())), // TODO maybe nil
54+
Some(v) => Ok(Edn::Str(v.as_str().to_string().into())),
55+
None => Ok(Edn::Str("".to_owned().into())), // TODO maybe nil
5656
}
5757
}
5858
Err(e) => Err(format!("re-find failed, {}", e)),
@@ -73,9 +73,9 @@ pub fn re_find_all(args: Vec<Edn>) -> Result<Edn, String> {
7373
Ok(p) => {
7474
let mut ys: Vec<Edn> = vec![];
7575
for v in p.find_iter(s) {
76-
ys.push(Edn::Str(v.as_str().to_string().into_boxed_str()))
76+
ys.push(Edn::Str(v.as_str().to_string().into()))
7777
}
78-
Ok(Edn::List(ys))
78+
Ok(Edn::List(EdnListView(ys)))
7979
}
8080
Err(e) => Err(format!("re-find-all failed, {}", e)),
8181
},
@@ -96,7 +96,7 @@ pub fn re_split(args: Vec<Edn>) -> Result<Edn, String> {
9696
for piece in p.split(s) {
9797
ys.push(Edn::str(piece));
9898
}
99-
Ok(Edn::List(ys))
99+
Ok(Edn::List(EdnListView(ys)))
100100
}
101101
Err(e) => Err(format!("re-split failed, {}", e)),
102102
},
@@ -112,13 +112,10 @@ pub fn re_replace_all(args: Vec<Edn>) -> Result<Edn, String> {
112112
if args.len() == 3 {
113113
match (&args[0], &args[1], &args[2]) {
114114
(Edn::Str(s), Edn::Str(pattern), Edn::Str(next)) => match Regex::new(pattern) {
115-
Ok(p) => Ok(Edn::str(p.replace_all(&**s, &**next).into_owned())),
115+
Ok(p) => Ok(Edn::str(p.replace_all(s, &**next).into_owned())),
116116
Err(e) => Err(format!("re-replace-all failed, {}", e)),
117117
},
118-
(a, b, c) => Err(format!(
119-
"re-replace-all expected 3 strings: {} {} {}",
120-
a, b, c
121-
)),
118+
(a, b, c) => Err(format!("re-replace-all expected 3 strings: {} {} {}", a, b, c)),
122119
}
123120
} else {
124121
Err(format!("re-replace-all expected 3 strings: {:?}", args))

0 commit comments

Comments
 (0)