kimchi/circuits/witness/
variable_cell.rs

1use super::{variables::Variables, WitnessCell};
2use ark_ff::Field;
3
4/// Witness cell assigned from a variable
5/// See [Variables] for more details
6pub struct VariableCell<'a> {
7    name: &'a str,
8}
9
10impl<'a> VariableCell<'a> {
11    /// Create witness cell assigned from a variable name
12    pub fn create(name: &'a str) -> Box<VariableCell<'a>> {
13        Box::new(VariableCell { name })
14    }
15}
16
17impl<'a, F: Field, const W: usize> WitnessCell<F, F, W> for VariableCell<'a> {
18    fn value(&self, _witness: &mut [Vec<F>; W], variables: &Variables<F>, _index: usize) -> F {
19        variables[self.name]
20    }
21}