diff --git a/src/lib.rs b/src/lib.rs index fae9a0b..cec9056 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -236,7 +236,7 @@ where /// field_two: HashSet, /// } /// -/// get_typed_blob(|bytes| Ok(bincode::deserialize(bytes)?)).unwrap_or(MyType { +/// get_typed_blob(|bytes| bincode::deserialize(bytes)).unwrap_or(MyType { /// field: HashMap::new(), /// field_two: HashSet::new(), /// }); @@ -272,7 +272,7 @@ where /// field_two: HashSet, /// } /// -/// get_typed_state(|bytes| Ok(bincode::deserialize(bytes)?)).unwrap_or(MyStateType { +/// get_typed_state(|bytes| bincode::deserialize(bytes)).unwrap_or(MyStateType { /// field: HashMap::new(), /// field_two: HashSet::new(), /// }); diff --git a/src/vfs/file.rs b/src/vfs/file.rs index 861d8ea..f4718ff 100644 --- a/src/vfs/file.rs +++ b/src/vfs/file.rs @@ -323,6 +323,14 @@ impl File { } } +impl Drop for File { + fn drop(&mut self) { + vfs_request(&self.path, VfsAction::CloseFile) + .send() + .unwrap(); + } +} + /// Creates a drive with path "/package_id/drive", gives you read and write caps. /// Will only work on the same package_id as you're calling it from, unless you /// have root capabilities.