use std::io::{BufReader, BufRead};
use std::io;
fn read_lines(filename: String) -> io::Lines<BufReader<File>> {
let file = File::open(filename).unwrap();
return io::BufReader::new(file).lines();
}
pub fn main() {
let mut doc_reg: Vec<&str> = vec![];
let mut attach_reg: Vec<Vec<&str>> = vec![];
let regcontent = read_lines("./config.txt".to_string());
for line in regcontent{
let a = line.unwrap(); # B point
let c:Vec<&str> = a.split("||").collect();
if c.get(0).unwrap() == &"K1"{
doc_reg = c.clone().drain(1..).collect();
}else if c.get(0).unwrap() == &"K2" {
let tempvc: Vec<_> = c.clone().drain(1..).collect();
attach_reg.push(tempvc.clone()); #A point
}
}
}
I add the # A point, then error appers at B point, how to modify to have it works?