We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
2 parents ad27f82 + 893de44 commit dd26bc8Copy full SHA for dd26bc8
1 file changed
src/trait/drop.md
@@ -76,15 +76,15 @@ impl TempFile {
76
}
77
78
// When TempFile is dropped:
79
-// 1. First, the File will be automatically closed (Drop for File)
80
-// 2. Then our drop implementation will remove the file
+// 1. First, our drop implementation will remove the file's name from the filesystem.
+// 2. Then, File's drop will close the file, removing its underlying content from the disk.
81
impl Drop for TempFile {
82
fn drop(&mut self) {
83
- // Note: File is already closed at this point
84
if let Err(e) = std::fs::remove_file(&self.path) {
85
eprintln!("Failed to remove temporary file: {}", e);
86
87
println!("> Dropped temporary file: {:?}", self.path);
+ // File's drop is implicitly called here because it is a field of this struct.
88
89
90
0 commit comments