Skip to content

Commit

Permalink
droptraitを入れました
Browse files Browse the repository at this point in the history
  • Loading branch information
yuiveslkao committed Jan 6, 2025
1 parent 2f6ba98 commit 77b17ef
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions judge_control_app/src/custom_rc/readonly_file.rs
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,20 @@ impl ReadonlyFile {
}
}

impl Drop for ReadonlyFile {
fn drop(&mut self) {
let result = std::fs::remove_file(&self.path).context(format!(
"Failed to remove file while dropping ReadonlyFile : {:?}",
self.path
));
match result {
Ok(_) => {}
Err(e) => {
eprintln!("{:?}", e);
}
}
}
}
impl super::File for ReadonlyFile {
fn path(&self) -> PathBuf {
self.path.clone()
Expand Down

0 comments on commit 77b17ef

Please sign in to comment.