From 87a8a04db5c0a80c06819ec6caf1568b7202cf51 Mon Sep 17 00:00:00 2001 From: Xusheng Date: Tue, 28 Sep 2021 14:19:23 +0800 Subject: Check in the debugger --- rust/src/custombinaryview.rs | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) (limited to 'rust/src/custombinaryview.rs') diff --git a/rust/src/custombinaryview.rs b/rust/src/custombinaryview.rs index 3afc6dc6..d547c388 100644 --- a/rust/src/custombinaryview.rs +++ b/rust/src/custombinaryview.rs @@ -55,6 +55,16 @@ where }) } + extern "C" fn cb_deprecated(ctxt: *mut c_void) -> bool + where + T: CustomBinaryViewType, + { + ffi_wrap!("BinaryViewTypeBase::is_deprecated", unsafe { + let view_type = &*(ctxt as *mut T); + view_type.is_deprecated() + }) + } + extern "C" fn cb_create(ctxt: *mut c_void, data: *mut BNBinaryView) -> *mut BNBinaryView where T: CustomBinaryViewType, @@ -117,6 +127,7 @@ where create: Some(cb_create::), parse: Some(cb_parse::), isValidForData: Some(cb_valid::), + isDeprecated: Some(cb_deprecated::), getLoadSettingsForData: Some(cb_load_settings::), }; @@ -141,6 +152,8 @@ where pub trait BinaryViewTypeBase: AsRef { fn is_valid_for(&self, data: &BinaryView) -> bool; + fn is_deprecated(&self) -> bool; + fn load_settings_for_data(&self, data: &BinaryView) -> Result> { let settings_handle = unsafe { BNGetBinaryViewDefaultLoadSettingsForData(self.as_ref().0, data.handle) }; @@ -233,6 +246,10 @@ impl BinaryViewTypeBase for BinaryViewType { unsafe { BNIsBinaryViewTypeValidForData(self.0, data.handle) } } + fn is_deprecated(&self) -> bool { + unsafe { BNIsBinaryViewTypeDeprecated(self.0) } + } + fn load_settings_for_data(&self, data: &BinaryView) -> Result> { let settings_handle = unsafe { BNGetBinaryViewDefaultLoadSettingsForData(self.as_ref().0, data.handle) }; -- cgit v1.3.1