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,
)
| 184 | /// |
| 185 | /// NOTE: The progress callback will _only_ be called when loading BNDBs. |
| 186 | pub 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>> |
| 192 | where |
| 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 | |
| 227 | pub fn load_view<O>( |
| 228 | bv: &BinaryView, |
no test coverage detected