impl Drop for Store

This commit is contained in:
Matthias Beyer 2016-01-13 21:51:40 +01:00
parent 92f03edf2b
commit d23e2f920d

View file

@ -1,5 +1,6 @@
use std::collections::HashMap;
use std::fs::File;
use std::ops::Drop;
use std::path::PathBuf;
use std::result::Result as RResult;
use std::sync::Arc;
@ -43,3 +44,16 @@ impl Store {
}
impl Drop for Store {
/**
* Unlock all files on drop
*
* TODO: Error message when file cannot be unlocked?
*/
fn drop(&mut self) {
self.cache.iter().map(|f| f.unlock());
}
}