mirror of
https://github.com/tlsnotary/tlsn.git
synced 2026-01-08 21:08:04 -05:00
moved GateOps
This commit is contained in:
@@ -1,8 +1,7 @@
|
||||
pub mod parse;
|
||||
|
||||
use crate::element::GateOps;
|
||||
use crate::errors::CircuitEvalError;
|
||||
use crate::gate::Gate;
|
||||
use crate::gate::{Gate, GateOps};
|
||||
|
||||
#[derive(Clone, Debug, PartialEq)]
|
||||
pub struct Circuit {
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
use super::GateOps;
|
||||
use crate::errors::GateOpsError;
|
||||
use crate::gate::GateOps;
|
||||
|
||||
pub type Bool = u8;
|
||||
|
||||
|
||||
@@ -1,12 +0,0 @@
|
||||
use crate::errors::GateOpsError;
|
||||
|
||||
pub trait GateOps: Clone + Copy {
|
||||
/// XOR `self` and `x`
|
||||
fn xor(&self, x: &Self) -> Result<Self, GateOpsError>;
|
||||
|
||||
/// INV `self`
|
||||
fn inv(&self) -> Result<Self, GateOpsError>;
|
||||
|
||||
/// AND `self` and `x`
|
||||
fn and(&self, x: &Self) -> Result<Self, GateOpsError>;
|
||||
}
|
||||
@@ -1,8 +1,6 @@
|
||||
mod boolean;
|
||||
mod gate_ops;
|
||||
|
||||
pub use boolean::Bool;
|
||||
pub use gate_ops::GateOps;
|
||||
|
||||
/// An element that has some modulus
|
||||
pub trait HasModulus {
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
use crate::errors::GateOpsError;
|
||||
|
||||
/// Basic components of a circuit.
|
||||
///
|
||||
/// `id` represents the gate id.
|
||||
@@ -23,3 +25,15 @@ pub(crate) enum Gate {
|
||||
zref: usize,
|
||||
},
|
||||
}
|
||||
|
||||
/// Trait required for implementor to be evaluated in a circuit
|
||||
pub trait GateOps: Clone + Copy {
|
||||
/// XOR `self` and `x`
|
||||
fn xor(&self, x: &Self) -> Result<Self, GateOpsError>;
|
||||
|
||||
/// INV `self`
|
||||
fn inv(&self) -> Result<Self, GateOpsError>;
|
||||
|
||||
/// AND `self` and `x`
|
||||
fn and(&self, x: &Self) -> Result<Self, GateOpsError>;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user