core: convert io::Res over to the Drop trait
This commit is contained in:
parent
e4d4a1499b
commit
e22d2bc4bc
@ -1108,10 +1108,13 @@ pub mod fsync {
|
||||
// Artifacts that need to fsync on destruction
|
||||
pub struct Res<t: Copy> {
|
||||
arg: Arg<t>,
|
||||
drop {
|
||||
}
|
||||
|
||||
impl<T: Copy> Res<T>: Drop {
|
||||
fn finalize(&self) {
|
||||
match self.arg.opt_level {
|
||||
option::None => (),
|
||||
option::Some(level) => {
|
||||
None => (),
|
||||
Some(level) => {
|
||||
// fail hard if not succesful
|
||||
assert((self.arg.fsync_fn)(self.arg.val, level) != -1);
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user