use shorthand constraint syntax and formatting
Signed-off-by: Jason Volk <jason@zemos.net>
This commit is contained in:
parent
a388c2e06e
commit
611f09829e
1 changed files with 2 additions and 8 deletions
|
@ -1,17 +1,11 @@
|
|||
#[macro_export]
|
||||
macro_rules! defer {
|
||||
($body:block) => {
|
||||
struct _Defer_<F>
|
||||
where
|
||||
F: FnMut(),
|
||||
{
|
||||
struct _Defer_<F: FnMut()> {
|
||||
closure: F,
|
||||
}
|
||||
|
||||
impl<F> Drop for _Defer_<F>
|
||||
where
|
||||
F: FnMut(),
|
||||
{
|
||||
impl<F: FnMut()> Drop for _Defer_<F> {
|
||||
fn drop(&mut self) { (self.closure)(); }
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue