Skip to content

Commit 18a11bc

Browse files
committed
vfs file: dropping a File object sends a CloseFile to vfs
1 parent 04553a0 commit 18a11bc

File tree

1 file changed

+8
-6
lines changed

1 file changed

+8
-6
lines changed

src/vfs/file.rs

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -20,12 +20,6 @@ impl File {
2020
}
2121
}
2222

23-
fn drop(&self) {
24-
vfs_request(&self.path, VfsAction::CloseFile)
25-
.send()
26-
.unwrap();
27-
}
28-
2923
/// Reads the entire file, from start position.
3024
/// Returns a vector of bytes.
3125
pub fn read(&self) -> Result<Vec<u8>, VfsError> {
@@ -329,6 +323,14 @@ impl File {
329323
}
330324
}
331325

326+
impl Drop for File {
327+
fn drop(&mut self) {
328+
vfs_request(&self.path, VfsAction::CloseFile)
329+
.send()
330+
.unwrap();
331+
}
332+
}
333+
332334
/// Creates a drive with path "/package_id/drive", gives you read and write caps.
333335
/// Will only work on the same package_id as you're calling it from, unless you
334336
/// have root capabilities.

0 commit comments

Comments
 (0)