MCPcopy Create free account
hub / github.com/Vector35/binaryninja-api / load_with_options_and_progress

Function load_with_options_and_progress

rust/src/lib.rs:186–225  ·  view source on GitHub ↗

Equivalent to [`load_with_options`] but with a progress callback. NOTE: The progress callback will _only_ be called when loading BNDBs.

(
    file_path: impl AsRef<Path>,
    update_analysis_and_wait: bool,
    options: Option<O>,
    mut progress: P,
)

Source from the content-addressed store, hash-verified

184///
185/// NOTE: The progress callback will _only_ be called when loading BNDBs.
186pub fn load_with_options_and_progress<O, P>(
187 file_path: impl AsRef<Path>,
188 update_analysis_and_wait: bool,
189 options: Option<O>,
190 mut progress: P,
191) -> Option<Ref<BinaryView>>
192where
193 O: IntoJson,
194 P: ProgressCallback,
195{
196 let file_path = file_path.as_ref().into_bytes_with_nul();
197 let options_or_default = if let Some(opt) = options {
198 opt.get_json_string()
199 .ok()?
200 .into_bytes_with_nul()
201 .as_ref()
202 .to_vec()
203 } else {
204 Metadata::new_of_type(MetadataType::KeyValueDataType)
205 .get_json_string()
206 .ok()?
207 .as_ref()
208 .to_vec()
209 };
210 let handle = unsafe {
211 BNLoadFilename(
212 file_path.as_ptr() as *mut _,
213 update_analysis_and_wait,
214 options_or_default.as_ptr() as *mut c_char,
215 Some(P::cb_progress_callback),
216 &mut progress as *mut P as *mut c_void,
217 )
218 };
219
220 if handle.is_null() {
221 None
222 } else {
223 Some(unsafe { BinaryView::ref_from_raw(handle) })
224 }
225}
226
227pub fn load_view<O>(
228 bv: &BinaryView,

Callers 2

load_with_optionsFunction · 0.85

Calls 4

into_bytes_with_nulMethod · 0.80
to_vecMethod · 0.80
as_refMethod · 0.45
get_json_stringMethod · 0.45

Tested by

no test coverage detected