diff options
author | Jesse Luehrs <doy@tozt.net> | 2013-04-03 02:45:53 -0500 |
---|---|---|
committer | Jesse Luehrs <doy@tozt.net> | 2013-04-03 02:46:18 -0500 |
commit | 0465ddb62b7708819a668aced5ade29cde6a8be0 (patch) | |
tree | 86ef870df906b279ed9e4c63ee5a7ee1b41b3bd7 /src/util.rs | |
parent | 3e95a135f67b52589957c14595ad3837c7f2f1e5 (diff) | |
download | rust-term-0465ddb62b7708819a668aced5ade29cde6a8be0.tar.gz rust-term-0465ddb62b7708819a668aced5ade29cde6a8be0.zip |
split this out into a separate module too
Diffstat (limited to 'src/util.rs')
-rw-r--r-- | src/util.rs | 15 |
1 files changed, 0 insertions, 15 deletions
diff --git a/src/util.rs b/src/util.rs index 1a4e1c3..2b3580e 100644 --- a/src/util.rs +++ b/src/util.rs @@ -1,20 +1,5 @@ use core::libc::{c_int,c_uint}; -pub fn guard<T> (finally: ~fn (), body: &fn () -> T) -> T { - let _guard = Guard { finally: finally }; - body() -} - -struct Guard { - priv finally: ~fn (), -} - -impl Drop for Guard { - fn finalize (&self) { - (self.finally)(); - } -} - // XXX huge hack until there's a better built-in way to do this pub fn timed_read (timeout: int) -> Option<char> { let first = unsafe { io_helper::timed_read(timeout as c_int) }; |