Skip to content

Commit 93ab9ee

Browse files
committed
[Rust] Impl BinaryViewEventHandler for Fn(&BinaryView)
So you can pass a closure to the register function
1 parent 91b9f45 commit 93ab9ee

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

rust/src/binary_view.rs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2709,6 +2709,12 @@ pub trait BinaryViewEventHandler: 'static + Sync {
27092709
fn on_event(&self, binary_view: &BinaryView);
27102710
}
27112711

2712+
impl<F: Fn(&BinaryView) + 'static + Sync> BinaryViewEventHandler for F {
2713+
fn on_event(&self, binary_view: &BinaryView) {
2714+
self(binary_view);
2715+
}
2716+
}
2717+
27122718
/// Registers an event listener for binary view events.
27132719
///
27142720
/// # Example

0 commit comments

Comments
 (0)