Refactor macro
More minor refactoring of macro introduced 3 commits ago.
This commit is contained in:
parent
6d3a07975d
commit
6e2e67f086
1 changed files with 3 additions and 3 deletions
|
@ -6,15 +6,15 @@ macro_rules! cleanup_func {
|
||||||
$(var_pair: $orig_var:expr, $new_var:ident),*) => {
|
$(var_pair: $orig_var:expr, $new_var:ident),*) => {
|
||||||
$(let $new_var = $orig_var;)*
|
$(let $new_var = $orig_var;)*
|
||||||
|
|
||||||
struct $name <T: Fn() -> ()> {
|
struct $name <T: Fn()> {
|
||||||
func: T,
|
func: T,
|
||||||
}
|
}
|
||||||
impl<T> Drop for $name <T> where T: Fn() -> () {
|
impl<T> Drop for $name <T> where T: Fn() {
|
||||||
fn drop(&mut self) {
|
fn drop(&mut self) {
|
||||||
(self.func)();
|
(self.func)();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
impl<T> $name <T> where T: Fn() -> () {
|
impl<T> $name <T> where T: Fn() {
|
||||||
fn new(func: T) -> Self {
|
fn new(func: T) -> Self {
|
||||||
Self {
|
Self {
|
||||||
func,
|
func,
|
||||||
|
|
Loading…
Reference in a new issue