No return from spawn

fn process_clfiles(datas: FileParametres, new_path_obj: &mut Vec<PathBuf>, num_files: Option<usize>) 
    -> StdtResult<FileParametres>
    {
        let args: Vec<String> = //..
let num_files= //... Digit
let mut fiter = args.chunks_exact(num_files);
let files_vec: Arc<Mutex<Vec<FileParametres>>> = Arc::new(Mutex::new(Vec::with_capacity(num_files as usize *2)));
let mut paths_buf: Vec<PathBuf>= Vec::<PathBuf>::new();
/*Initialize paths_buf*/
let temp_vec= paths_buf.clone();
let paths_hs: HashSet<PathBuf> = temp_vec.into_iter().collect();//remain unique file names
//else if from beggin create HashSet, I would need to check on insert returned value every if let ...
//___________________________________________________
//fetch and modify file data _ извлекаем и изменяем данные файла
let new_path_obj=  Arc::new(Mutex::new(paths_hs));//.clone()
let mut threads = Vec::with_capacity(args.len());
let files_vec = Arc::clone(&files_vec);
crossbeam::scope(|spawner| {
    for (fi, file) in next_fvec.into_iter().enumerate() {
        let mut files_vecs=  Arc::clone(&files_vec);
        let fnames= Arc::clone(&new_path_obj);
        threads.push(spawner.spawn(move || { 
            let file_content = fs::read_to_string(&file)
                .expect("While reading occured an error");
            let crude_data: String = file_content.split("\n ").map(|x| str::to_string(x.trim())).collect();
        let rinsed_data: Vec<&str> = crude_data.split("\n").collect();
        let mut new_init_data = Vec::with_capacity(25);
//Not important
        let (x_min,x_max) = parse_pair::<f32>(new_init_data[1].as_str(), ':').expect("Second argument margin_domain must be tuple of pair");
        let (i1,i2,i3) = parse_three::<f32>(new_init_data[5].as_str(), ':').expect("Forth argument is init_conditions, must be three digits here");
        let (t1,t2) = parse_pair::<f32>(new_init_data[2].as_str(), ':').expect("3d argument is time,also three digits");

let path = env::current_dir().unwrap();
let new_path = path.join(format!(r"src\treated_datas_{}", fi));
fs::create_dir_all(&new_path).unwrap(); //env::temp_dir();
let temp_fi = &new_path.join(format!("parameters_{}.txt", fi));
let mut processed_params =  std::fs::File::open(&temp_fi).unwrap_or_else(|error| {
    if error.kind() == ErrorKind::NotFound {
        File::create(&temp_fi).unwrap_or_else(|error| {
            panic!("Problem creating the file: {:?}", error);
        })
    } else {
        panic!("Problem opening the file: {:?}", error);
    }
});
let next_pathbuf= &temp_fi
let pb= (*next_pathbuf).clone();
    write!(&mut processed_params, "equation_type:{data1}  ... "
data1 = new_init_data[0]//..........
).unwrap();

        let all_datas: FileParametres;
        all_datas = //FileParametres::new(new_init_data[0].to_string()//...
        println!("{:?} this is from file\n", all_datas);
        //then push all in earlier created vector for storing processed files
        files_vecs.lock().unwrap().push(all_datas);
        println!("............");
    /*after this raw  ******** */}));//$Close threads!
    println!("............");}
});//Crossbeam!
threads.into_iter().for_each(|thread| {
    println!("The child thread ID: {:?}", thread.thread().id());
        thread
            .join();
            //.expect("The thread creating or execution failed !")
    });
    println!("............");};//Process all files...
let result = files_vec.lock().unwrap().to_vec().clone();
drop(files_vec);
println!("............");
Ok(result)  
}

Problem- after raw where threads.push(....) ******** println!("............") doesn't print. I tried to left minimum code*

I tried to run this through rustfmt to make it even remotely readable, but I get this:

error: unexpected closing delimiter: `)`
 --> /playground/src/main.rs:6:14
  |
3 |     {
  |     - this opening brace...
...
6 |             });
  |             -^ unexpected closing delimiter
  |             |
  |             ...matches this closing brace

First let args= //... Maybe forget about delimeter...
But there are no values, you may create, push something... From command line (expect txt file)

Your code is very poorly formatted and nearly unreadable. Please run it through rustfmt and post it again.

This topic was automatically closed 90 days after the last reply. We invite you to open a new topic if you have further questions or comments.