20241024 finished.

This commit is contained in:
2024-10-24 09:08:13 +08:00
parent 3102da99a8
commit bce8de1c85
266 changed files with 2321 additions and 2014 deletions

View File

@@ -1,7 +1,7 @@
use crate::fetch_problem::{Fetcher, ProblemManager};
use std::fs;
use std::io::Write;
use std::path::Path;
use crate::fetch_problem::{Fetcher, ProblemManager};
mod fetch_problem;
@@ -22,12 +22,16 @@ async fn main() {
println!("Try to get problem {}...", id);
let problem = fetcher.get_problem(id).await
let problem = fetcher
.get_problem(id)
.await
.expect(&*format!("Failed to get problem {}.", id));
let file_name = problem.get_filename();
println!("Get problem: {}.", file_name);
let content = problem.get_file_content().expect("Failed to format file content");
let content = problem
.get_file_content()
.expect("Failed to format file content");
write_file(&file_name, &content).expect("Failed to write problem file.");
}
@@ -55,4 +59,4 @@ fn write_file(file_name: &String, file_content: &String) -> std::io::Result<()>
.open("./src/problem/mod.rs")?;
write!(mod_file, "\nmod {};", file_name)
}
}