core: convert io::Res over to the Drop trait

This commit is contained in:
Erick Tryzelaar 2013-01-22 07:51:00 -08:00
parent e4d4a1499b
commit e22d2bc4bc

View File

@ -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);
}