summaryrefslogtreecommitdiff
path: root/rust/src/command.rs
diff options
context:
space:
mode:
authorRubens Brandao <git@rubens.io>2024-04-17 12:35:04 -0300
committerKyle Martin <krm504@nyu.edu>2024-05-09 14:00:01 -0400
commitc528f3ad0e1abd4168b1507e8c30bc14c4a6a736 (patch)
tree83d13b9b64be9383929e755efa97fd4877b5f2ec /rust/src/command.rs
parent71a1c7e162046a44e7640e468b69a2b59599b198 (diff)
fix rust doc code
Diffstat (limited to 'rust/src/command.rs')
-rw-r--r--rust/src/command.rs38
1 files changed, 28 insertions, 10 deletions
diff --git a/rust/src/command.rs b/rust/src/command.rs
index f5332734..e682baee 100644
--- a/rust/src/command.rs
+++ b/rust/src/command.rs
@@ -16,12 +16,16 @@
//!
//! All plugins need to provide one of the following functions for Binary Ninja to call:
//!
-//! ```rust
-//! pub extern "C" fn CorePluginInit() -> bool {}
+//! ```no_run
+//! pub extern "C" fn CorePluginInit() -> bool {
+//! todo!();
+//! }
//! ```
//!
-//! ```rust
-//! pub extern "C" fn UIPluginInit() -> bool {}
+//! ```no_run
+//! pub extern "C" fn UIPluginInit() -> bool {
+//! todo!();
+//! }
//! ```
//!
//! Both of these functions can call any of the following registration functions, though `CorePluginInit` is called during Binary Ninja core initialization, and `UIPluginInit` is called during Binary Ninja UI initialization.
@@ -62,7 +66,9 @@ where
/// The function call required for generic commands; commands added in this way will be in the `Plugins` submenu of the menu bar.
///
/// # Example
-/// ```rust
+/// ```no_run
+/// # use binaryninja::command::Command;
+/// # use binaryninja::binaryview::BinaryView;
/// struct MyCommand;
///
/// impl Command for MyCommand {
@@ -76,6 +82,7 @@ where
/// }
/// }
///
+/// # use binaryninja::command::register;
/// #[no_mangle]
/// pub extern "C" fn CorePluginInit() -> bool {
/// register(
@@ -160,7 +167,9 @@ where
/// The function call required for generic commands; commands added in this way will be in the `Plugins` submenu of the menu bar.
///
/// # Example
-/// ```rust
+/// ```no_run
+/// # use binaryninja::command::AddressCommand;
+/// # use binaryninja::binaryview::BinaryView;
/// struct MyCommand;
///
/// impl AddressCommand for MyCommand {
@@ -174,6 +183,7 @@ where
/// }
/// }
///
+/// # use binaryninja::command::register_for_address;
/// #[no_mangle]
/// pub extern "C" fn CorePluginInit() -> bool {
/// register_for_address(
@@ -258,10 +268,13 @@ where
/// The function call required for generic commands; commands added in this way will be in the `Plugins` submenu of the menu bar.
///
/// # Example
-/// ```rust
+/// ```no_run
+/// # use std::ops::Range;
+/// # use binaryninja::command::RangeCommand;
+/// # use binaryninja::binaryview::BinaryView;
/// struct MyCommand;
///
-/// impl AddressCommand for MyCommand {
+/// impl RangeCommand for MyCommand {
/// fn action(&self, view: &BinaryView, range: Range<u64>) {
/// // Your code here
/// }
@@ -272,6 +285,7 @@ where
/// }
/// }
///
+/// # use binaryninja::command::register_for_range;
/// #[no_mangle]
/// pub extern "C" fn CorePluginInit() -> bool {
/// register_for_range(
@@ -361,10 +375,14 @@ where
/// The function call required for generic commands; commands added in this way will be in the `Plugins` submenu of the menu bar.
///
/// # Example
-/// ```rust
+/// ```no_run
+/// # use binaryninja::command::FunctionCommand;
+/// # use binaryninja::binaryview::BinaryView;
+/// # use binaryninja::function::Function;
+/// # use binaryninja::command::register_for_function;
/// struct MyCommand;
///
-/// impl AddressCommand for MyCommand {
+/// impl FunctionCommand for MyCommand {
/// fn action(&self, view: &BinaryView, func: &Function) {
/// // Your code here
/// }