pub fn find_with_value(&mut self, val: &Witness) -> Option<String> {
        let mut found = None;
        for scope in self.env.current_scope_tree().0.iter().rev() {
            found = scope.0.iter().find_map(|(k, v)| match v {
                Object::Null | Object::Array(_) | Object::Constants(_) | Object::Arithmetic(_) => {
                    None
                }
                Object::Integer(x) => {
                    // Integers are assumed to always be unit
                    (&x.witness == val).then(|| k)
                }
                Object::Linear(x) => (x.is_unit() && &x.witness == val).then(|| k),
            });
            if found.is_some() {
                break;
            }
        }
        found.cloned()
    }
// This method is somewhat of a hack, due to the fact that we do not map
// Witness indices to variable names.
This method is somewhat of a hack, due to the fact that we do not map
Witness indices to variable names.
This method is somewhat of a hack due to the fact that we do not map Witness indices to variable names .
pub fn find_with_value(&mut self, val: &Witness) -> Option<String> {
        let mut found = None;
        for scope in self.env.current_scope_tree().0.iter().rev() {
            found = scope.0.iter().find_map(|(k, v)| match v {
                Object::Null | Object::Array(_) | Object::Constants(_) | Object::Arithmetic(_) => {
                    None
                }
                Object::Integer(x) => {
                    // Integers are assumed to always be unit
                    (&x.witness == val).then(|| k)
                }
                Object::Linear(x) => (x.is_unit() && &x.witness == val).then(|| k),
            });
            if found.is_some() {
                break;
            }
        }
        found.cloned()
    }
pub fn find_with_value ( & mut self , val : & Witness ) -> Option < String > { let mut found = None ; for scope in self . env . current_scope_tree ( ) . 0 . iter ( ) . rev ( ) { found = scope . 0 . iter ( ) . find_map ( | ( k , v ) | match v { Object :: Null | Object :: Array ( _ ) | Object :: Constants ( _ ) | Object :: Arithmetic ( _ ) => { None } Object :: Integer ( x ) => { // Integers are assumed to always be unit ( & x . witness == val ) . then ( | | k ) } Object :: Linear ( x ) => ( x . is_unit ( ) && & x . witness == val ) . then ( | | k ) , } ) ; if found . is_some ( ) { break ; } } found . cloned ( ) }
This method is somewhat of a hack, due to the fact that we do not map
Witness indices to variable names.
This method is somewhat of a hack due to the fact that we do not map Witness indices to variable names .
&mut self
val
&Witness
&mut self
val
&Witness