summaryrefslogtreecommitdiff
path: root/rust
diff options
context:
space:
mode:
authorMason Reed <mason@vector35.com>2026-03-13 12:21:22 -0700
committerMason Reed <35282038+emesare@users.noreply.github.com>2026-03-24 18:46:48 -0700
commitf9d2e6f1d605d7d1a1a227b4fb1d367693bc0742 (patch)
treeff3e8653233658e6318036a3348d440c03f412c7 /rust
parentc43ecea6535c12d8b04ca8cede1a35cb9fb66af9 (diff)
[Rust] Impl `BinaryViewEventHandler` for `Fn(&BinaryView)`
So you can pass a closure to the register function
Diffstat (limited to 'rust')
-rw-r--r--rust/src/binary_view.rs6
1 files changed, 6 insertions, 0 deletions
diff --git a/rust/src/binary_view.rs b/rust/src/binary_view.rs
index bd26dad3..b65367a2 100644
--- a/rust/src/binary_view.rs
+++ b/rust/src/binary_view.rs
@@ -2709,6 +2709,12 @@ pub trait BinaryViewEventHandler: 'static + Sync {
fn on_event(&self, binary_view: &BinaryView);
}
+impl<F: Fn(&BinaryView) + 'static + Sync> BinaryViewEventHandler for F {
+ fn on_event(&self, binary_view: &BinaryView) {
+ self(binary_view);
+ }
+}
+
/// Registers an event listener for binary view events.
///
/// # Example