summaryrefslogtreecommitdiff
path: root/rust/src/custom_binary_view.rs
diff options
context:
space:
mode:
authorMason Reed <mason@vector35.com>2025-02-25 15:53:32 -0500
committerMason Reed <mason@vector35.com>2025-02-25 15:53:32 -0500
commitb35c5776891075c6c67a8adcb19048baf87de38f (patch)
treeb357d49032c8fdd97b2a38af99509388d87d8361 /rust/src/custom_binary_view.rs
parentf4dd84641f5499abee06570e65272698c05a7fb6 (diff)
Make `register_platform_recognizer` return by ref in Rust API
Diffstat (limited to 'rust/src/custom_binary_view.rs')
-rw-r--r--rust/src/custom_binary_view.rs6
1 files changed, 3 insertions, 3 deletions
diff --git a/rust/src/custom_binary_view.rs b/rust/src/custom_binary_view.rs
index 42ebb8da..eb95acb2 100644
--- a/rust/src/custom_binary_view.rs
+++ b/rust/src/custom_binary_view.rs
@@ -258,12 +258,12 @@ pub trait BinaryViewTypeExt: BinaryViewTypeBase {
/// Support for this API tentatively requires explicit support in the [`BinaryView`] implementation.
fn register_platform_recognizer<R>(&self, id: u32, endian: Endianness, recognizer: R)
where
- R: 'static + Fn(&BinaryView, &Metadata) -> Option<Platform> + Send + Sync,
+ R: 'static + Fn(&BinaryView, &Metadata) -> Option<Ref<Platform>> + Send + Sync,
{
#[repr(C)]
struct PlatformRecognizerHandlerContext<R>
where
- R: 'static + Fn(&BinaryView, &Metadata) -> Option<Platform> + Send + Sync,
+ R: 'static + Fn(&BinaryView, &Metadata) -> Option<Ref<Platform>> + Send + Sync,
{
recognizer: R,
}
@@ -274,7 +274,7 @@ pub trait BinaryViewTypeExt: BinaryViewTypeBase {
metadata: *mut BNMetadata,
) -> *mut BNPlatform
where
- R: 'static + Fn(&BinaryView, &Metadata) -> Option<Platform> + Send + Sync,
+ R: 'static + Fn(&BinaryView, &Metadata) -> Option<Ref<Platform>> + Send + Sync,
{
let context = unsafe { &*(ctxt as *mut PlatformRecognizerHandlerContext<R>) };
let bv = unsafe { BinaryView::from_raw(bv).to_owned() };