Skip to content

Commit

Permalink
Implement default for Callback<T>
Browse files Browse the repository at this point in the history
  • Loading branch information
TheNeikos committed Mar 18, 2020
1 parent ebbd145 commit b5e5afb
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions src/callback.rs
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,12 @@ impl<IN> Callback<IN> {
}
}

impl<IN> Default for Callback<IN> {
fn default() -> Self {
Self::noop()
}
}

impl<IN: 'static> Callback<IN> {
/// Changes input type of the callback to another.
/// Works like common `map` method but in an opposite direction.
Expand Down Expand Up @@ -131,4 +137,10 @@ pub(crate) mod test_util {
}
}
}

#[derive(Default)]
struct DefaultCallbackProperties {
_callback: Callback<i32>,
}

}

0 comments on commit b5e5afb

Please sign in to comment.