Skip to content

Commit 203eb33

Browse files
committed
napi: wrapper for wires
1 parent 4b466af commit 203eb33

File tree

2 files changed

+29
-1
lines changed

2 files changed

+29
-1
lines changed

plonk-napi/src/wrappers/mod.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,3 @@
11
pub(crate) mod field;
2-
pub(crate) mod group;
2+
pub(crate) mod group;
3+
pub(crate) mod wires;

plonk-napi/src/wrappers/wires.rs

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
use kimchi::circuits::wires::Wire as KimchiWire;
2+
use napi_derive::napi;
3+
4+
#[napi(object)]
5+
#[derive(Clone, Copy, Debug, Default)]
6+
pub struct NapiWire {
7+
pub row: u32,
8+
pub col: u32,
9+
}
10+
11+
impl From<NapiWire> for KimchiWire {
12+
fn from(value: NapiWire) -> Self {
13+
KimchiWire {
14+
row: value.row as usize,
15+
col: value.col as usize,
16+
}
17+
}
18+
}
19+
20+
impl From<KimchiWire> for NapiWire {
21+
fn from(value: KimchiWire) -> Self {
22+
Self {
23+
row: value.row as u32,
24+
col: value.col as u32,
25+
}
26+
}
27+
}

0 commit comments

Comments
 (0)