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

        let value_rr = self.stack.pop().unwrap();
        let value_rrb = value_rr.borrow();
        let value_pre = value_rrb.to_string();
        let value_opt = to_string_2(&value_pre);

        match value_opt {
            Some(s) => {
                let res = std::fs::remove_file(s);
                match res {
                    Ok(_) => {}
                    Err(e) => {
                        let err_str =
                            format!("unable to remove file: {}", e.to_string());
                        print_error(chunk, i, &err_str);
                        return 0;
                    }
                }
            }
            _ => {
                print_error(chunk, i, "rm argument must be a string");
                return 0;
            }
        }
        return 1;
    }
/// Takes a value that can be stringified as its single argument.
/// Removes the file corresponding to that path.
Takes a value that can be stringified as its single argument.
Removes the file corresponding to that path.
Takes a value that can be stringified as its single argument . Removes the file corresponding to that path .
pub fn core_rm(&mut self, chunk: &Chunk, i: usize) -> i32 {
        if self.stack.len() < 1 {
            print_error(chunk, i, "rm requires one argument");
            return 0;
        }
        let value_rr = self.stack.pop().unwrap();
        let value_rrb = value_rr.borrow();
        let value_pre = value_rrb.to_string();
        let value_opt = to_string_2(&value_pre);
        match value_opt {
            Some(s) => {
                let res = std::fs::remove_file(s);
                match res {
                    Ok(_) => {}
                    Err(e) => {
                        let err_str =
                            format!("unable to remove file: {}", e.to_string());
                        print_error(chunk, i, &err_str);
                        return 0;
                    }
                }
            }
            _ => {
                print_error(chunk, i, "rm argument must be a string");
                return 0;
            }
        }
        return 1;
    }
pub fn core_rm ( & 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 value_rrb = value_rr . borrow ( ) ; let value_pre = value_rrb . to_string ( ) ; let value_opt = to_string_2 ( & value_pre ) ; match value_opt { Some ( s ) => { let res = std :: fs :: remove_file ( s ) ; match res { Ok ( _ ) => { } Err ( e ) => { let err_str = format ! ( " " e to_string ( ) ) ; print_error ( chunk , i , & err_str ) ; return 0 ; } } } _ => { print_error ( chunk , i , " " ) ; return 0 ; } } return 1 ; }
Takes a value that can be stringified as its single argument.
Takes a value that can be stringified as its single argument .
&mut self
chunk
&Chunk
i
usize