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 b16b540
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 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,9 @@ pub(crate) mod test_util {
}
}
}

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

0 comments on commit b16b540

Please sign in to comment.