From e8488aaa64fb847ca2e639369176cf88c1bc4f8e Mon Sep 17 00:00:00 2001 From: Brandon Miller Date: Wed, 2 Oct 2024 08:17:25 -0400 Subject: Added IsForceLoadable method to BinaryViewType --- rust/src/custombinaryview.rs | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) (limited to 'rust/src/custombinaryview.rs') diff --git a/rust/src/custombinaryview.rs b/rust/src/custombinaryview.rs index 1ec0ca80..2383ce1e 100644 --- a/rust/src/custombinaryview.rs +++ b/rust/src/custombinaryview.rs @@ -68,6 +68,16 @@ where }) } + extern "C" fn cb_force_loadable(ctxt: *mut c_void) -> bool + where + T: CustomBinaryViewType, + { + ffi_wrap!("BinaryViewTypeBase::is_force_loadable", unsafe { + let view_type = &*(ctxt as *mut T); + view_type.is_force_loadable() + }) + } + extern "C" fn cb_create(ctxt: *mut c_void, data: *mut BNBinaryView) -> *mut BNBinaryView where T: CustomBinaryViewType, @@ -153,6 +163,7 @@ where parse: Some(cb_parse::), isValidForData: Some(cb_valid::), isDeprecated: Some(cb_deprecated::), + isForceLoadable: Some(cb_force_loadable::), getLoadSettingsForData: Some(cb_load_settings::), }; @@ -182,6 +193,10 @@ pub trait BinaryViewTypeBase: AsRef { false } + fn is_force_loadable(&self) -> bool { + false + } + fn default_load_settings_for_data(&self, data: &BinaryView) -> Option> { let settings_handle = unsafe { BNGetBinaryViewDefaultLoadSettingsForData(self.as_ref().0, data.handle) }; @@ -296,6 +311,10 @@ impl BinaryViewTypeBase for BinaryViewType { unsafe { BNIsBinaryViewTypeDeprecated(self.0) } } + fn is_force_loadable(&self) -> bool { + unsafe { BNIsBinaryViewTypeForceLoadable(self.0) } + } + fn load_settings_for_data(&self, data: &BinaryView) -> Option> { let settings_handle = unsafe { BNGetBinaryViewLoadSettingsForData(self.0, data.handle) }; -- cgit v1.3.1