binaryninja::progress

Trait ProgressCallback

source
pub trait ProgressCallback: Sized {
    type SplitProgressType: SplitProgressBuilder;

    // Required methods
    fn progress(&mut self, progress: usize, total: usize) -> bool;
    fn split(self, subpart_weights: &'static [usize]) -> Self::SplitProgressType;

    // Provided methods
    unsafe extern "C" fn cb_progress_callback(
        ctxt: *mut c_void,
        progress: usize,
        total: usize,
    ) -> bool { ... }
    unsafe fn into_raw(&mut self) -> *mut c_void { ... }
}

Required Associated Types§

Required Methods§

source

fn progress(&mut self, progress: usize, total: usize) -> bool

source

fn split(self, subpart_weights: &'static [usize]) -> Self::SplitProgressType

Split a single progress function into proportionally sized subparts. This function takes the original progress function and returns a new function whose signature is the same but whose output is shortened to correspond to the specified subparts.

The length of a subpart is proportional to the sum of all the weights. E.g. with subpart_weights = &[ 25, 50, 25 ], this will return a function that calls progress_func and maps its progress to the ranges [0..=25, 25..=75, 75..=100]

Weights of subparts, described above

  • progress_func - Original progress function (usually updates a UI)
  • subpart_weights - Weights of subparts, described above

Provided Methods§

source

unsafe extern "C" fn cb_progress_callback( ctxt: *mut c_void, progress: usize, total: usize, ) -> bool

source

unsafe fn into_raw(&mut self) -> *mut c_void

Object Safety§

This trait is not object safe.

Implementors§