pub fn opcode_str(&mut self, chunk: &Chunk, i: usize) -> i32 {
        if self.stack.len() < 1 {
            print_error(chunk, i, "str requires one argument");
            return 0;
        }

        let value_rr = self.stack.pop().unwrap();
        let is_string;
        {
            let value_rrb = value_rr.borrow();
            match *value_rrb {
                Value::String(_, _) => {
                    is_string = true;
                }
                _ => {
                    let value_pre = value_rrb.to_string();
                    let value_opt = to_string_2(&value_pre);
                    match value_opt {
                        Some(s) => {
                            self.stack.push(Rc::new(RefCell::new(Value::String(s.to_string(), None))));
                            return 1;
                        }
                        _ => {
                            print_error(chunk, i, "unable to convert argument to string");
                            return 0;
                        }
                    }
                }
            }
        }
        if is_string {
            self.stack.push(value_rr);
        }
        return 1;
    }
/// Convert a value into a string value.
Convert a value into a string value.
Convert a value into a string value .
pub fn opcode_str(&mut self, chunk: &Chunk, i: usize) -> i32 {
        if self.stack.len() < 1 {
            print_error(chunk, i, "str requires one argument");
            return 0;
        }
        let value_rr = self.stack.pop().unwrap();
        let is_string;
        {
            let value_rrb = value_rr.borrow();
            match *value_rrb {
                Value::String(_, _) => {
                    is_string = true;
                }
                _ => {
                    let value_pre = value_rrb.to_string();
                    let value_opt = to_string_2(&value_pre);
                    match value_opt {
                        Some(s) => {
                            self.stack.push(Rc::new(RefCell::new(Value::String(s.to_string(), None))));
                            return 1;
                        }
                        _ => {
                            print_error(chunk, i, "unable to convert argument to string");
                            return 0;
                        }
                    }
                }
            }
        }
        if is_string {
            self.stack.push(value_rr);
        }
        return 1;
    }
pub fn opcode_str ( & mut self , chunk : & Chunk , i : usize ) -> i32 { if self . stack . len ( ) < 1 { print_error ( chunk , i , " " ) ; return 0 ; } let value_rr = self . stack . pop ( ) . unwrap ( ) ; let is_string ; { let value_rrb = value_rr . borrow ( ) ; match * value_rrb { Value :: String ( _ , _ ) => { is_string = true ; } _ => { let value_pre = value_rrb . to_string ( ) ; let value_opt = to_string_2 ( & value_pre ) ; match value_opt { Some ( s ) => { self . stack . push ( Rc :: new ( RefCell :: new ( Value :: String ( s . to_string ( ) , None ) ) ) ) ; return 1 ; } _ => { print_error ( chunk , i , " " ) ; return 0 ; } } } } } if is_string { self . stack . push ( value_rr ) ; } return 1 ; }
Convert a value into a string value.
Convert a value into a string value .
&mut self
chunk
&Chunk
i
usize