Skip to content

Commit 5e69961

Browse files
committed
Fix dependency on compiler in apis.
1 parent a27a2c5 commit 5e69961

File tree

4 files changed

+24
-8
lines changed

4 files changed

+24
-8
lines changed

Cargo.lock

+1-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

packages/apis/Cargo.toml

+2-1
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,8 @@ crate-type = ["rlib", "cdylib"]
1717
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
1818

1919
[dependencies]
20-
zk-regex-compiler = { path = "../compiler", default-features = false }
20+
# zk-regex-compiler = { path = "../compiler", default-features = false }
21+
serde = { version = "1.0.159", features = ["derive"] }
2122
fancy-regex = "0.11.0"
2223
itertools = "0.10.3"
2324
thiserror = "1.0.40"

packages/apis/src/extract_substrs.rs

+21-3
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,28 @@
11
use fancy_regex::Regex;
22
use neon::prelude::*;
3+
use serde::{Deserialize, Serialize};
34
use serde_json;
45
use thiserror::Error;
5-
use zk_regex_compiler::DecomposedRegexConfig;
6+
// use zk_regex_compiler::DecomposedRegexConfig;
7+
8+
/// A configuration of decomposed regexes.
9+
#[derive(Debug, Clone, Serialize, Deserialize)]
10+
pub struct DecomposedRegexConfig {
11+
pub parts: Vec<RegexPartConfig>,
12+
}
13+
14+
/// Decomposed regex part.
15+
#[derive(Debug, Clone, Serialize, Deserialize)]
16+
pub struct RegexPartConfig {
17+
/// A flag indicating whether the substring matching with `regex_def` should be exposed.
18+
pub is_public: bool,
19+
/// A regex string.
20+
pub regex_def: String,
21+
// Maximum byte size of the substring in this part.
22+
// pub max_size: usize,
23+
// (Optional) A solidity type of the substring in this part, e.g., "String", "Int", "Decimal".
24+
// pub solidity: Option<SoldityType>,
25+
}
626

727
/// Error definitions of the compiler.
828
#[derive(Error, Debug)]
@@ -374,8 +394,6 @@ pub fn extract_message_id_idxes_node(mut cx: FunctionContext) -> JsResult<JsArra
374394

375395
#[cfg(test)]
376396
mod test {
377-
use zk_regex_compiler::RegexPartConfig;
378-
379397
use super::*;
380398

381399
#[test]

packages/compiler/src/lib.rs

-3
Original file line numberDiff line numberDiff line change
@@ -38,9 +38,6 @@ pub enum CompilerError {
3838
/// A configuration of decomposed regexes.
3939
#[derive(Debug, Clone, Serialize, Deserialize)]
4040
pub struct DecomposedRegexConfig {
41-
/// Maximum byte size of the input string.
42-
// pub max_byte_size: usize,
43-
/// A vector of decomposed regexes.
4441
pub parts: Vec<RegexPartConfig>,
4542
}
4643

0 commit comments

Comments
 (0)