From f9d2e6f1d605d7d1a1a227b4fb1d367693bc0742 Mon Sep 17 00:00:00 2001 From: Mason Reed Date: Fri, 13 Mar 2026 12:21:22 -0700 Subject: [Rust] Impl `BinaryViewEventHandler` for `Fn(&BinaryView)` So you can pass a closure to the register function --- rust/src/binary_view.rs | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'rust/src/binary_view.rs') 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 BinaryViewEventHandler for F { + fn on_event(&self, binary_view: &BinaryView) { + self(binary_view); + } +} + /// Registers an event listener for binary view events. /// /// # Example -- cgit v1.3.1