Function register_command_for_range

Source
pub fn register_command_for_range<C>(name: &str, desc: &str, command: C)
where C: RangeCommand,
Expand description

The function call required for generic commands; commands added in this way will be in the Plugins submenu of the menu bar.

ยงExample

struct MyCommand;

impl RangeCommand for MyCommand {
    fn action(&self, view: &BinaryView, range: Range<u64>) {
        // Your code here
    }

    fn valid(&self, view: &BinaryView, range: Range<u64>) -> bool {
        // Your code here
        true
    }
}

#[no_mangle]
pub extern "C" fn CorePluginInit() -> bool {
    register_command_for_range(
        "My Plugin Command",
        "A description of my command",
        MyCommand {},
    );
    true
}