summaryrefslogtreecommitdiff
path: root/rust/src/custombinaryview.rs
diff options
context:
space:
mode:
authorBrandon Miller <brandon@vector35.com>2024-10-02 08:17:25 -0400
committerBrandon Miller <bkmiller89@icloud.com>2024-10-03 08:39:54 -0400
commite8488aaa64fb847ca2e639369176cf88c1bc4f8e (patch)
treed08bade433501d3c76eae26d05245122b8081437 /rust/src/custombinaryview.rs
parent1b8b9d4ee4936faa8c9091720a312bb72964d8b1 (diff)
Added IsForceLoadable method to BinaryViewType
Diffstat (limited to 'rust/src/custombinaryview.rs')
-rw-r--r--rust/src/custombinaryview.rs19
1 files changed, 19 insertions, 0 deletions
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<T>(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<T>(ctxt: *mut c_void, data: *mut BNBinaryView) -> *mut BNBinaryView
where
T: CustomBinaryViewType,
@@ -153,6 +163,7 @@ where
parse: Some(cb_parse::<T>),
isValidForData: Some(cb_valid::<T>),
isDeprecated: Some(cb_deprecated::<T>),
+ isForceLoadable: Some(cb_force_loadable::<T>),
getLoadSettingsForData: Some(cb_load_settings::<T>),
};
@@ -182,6 +193,10 @@ pub trait BinaryViewTypeBase: AsRef<BinaryViewType> {
false
}
+ fn is_force_loadable(&self) -> bool {
+ false
+ }
+
fn default_load_settings_for_data(&self, data: &BinaryView) -> Option<Ref<Settings>> {
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<Ref<Settings>> {
let settings_handle = unsafe { BNGetBinaryViewLoadSettingsForData(self.0, data.handle) };