kimchi/circuits/witness/constant_cell.rs
1use super::{variables::Variables, WitnessCell};
2use ark_ff::Field;
3
4/// Witness cell with constant value
5pub struct ConstantCell<F: Field> {
6 value: F,
7}
8
9impl<F: Field> ConstantCell<F> {
10 /// Create witness cell with constant value
11 pub fn create(value: F) -> Box<ConstantCell<F>> {
12 Box::new(ConstantCell { value })
13 }
14}
15
16impl<F: Field, const W: usize> WitnessCell<F, F, W> for ConstantCell<F> {
17 fn value(&self, _witness: &mut [Vec<F>; W], _variables: &Variables<F>, _index: usize) -> F {
18 self.value
19 }
20}