summaryrefslogtreecommitdiff
path: root/rust/src/lib.rs
diff options
context:
space:
mode:
Diffstat (limited to 'rust/src/lib.rs')
-rw-r--r--rust/src/lib.rs13
1 files changed, 6 insertions, 7 deletions
diff --git a/rust/src/lib.rs b/rust/src/lib.rs
index 3eff5ea1..d6161d53 100644
--- a/rust/src/lib.rs
+++ b/rust/src/lib.rs
@@ -72,20 +72,17 @@
//! The most up-to-date version of the suggested [`build.rs` is here].
//!
//! ### `main.rs`
-//! All standalone binaries need to call [`headless::init()`] at start and [`headless::shutdown()`] at shutdown.
+//! Standalone binaries need to initialize Binary Ninja before they can work. You can do this through [`headless::Session`], [`headless::script_helper`], or [`headless::init()`] at start and [`headless::shutdown()`] at shutdown.
//! ```rust
//! fn main() {
//! // This loads all the core architecture, platform, etc plugins
//! // Standalone executables need to call this, but plugins do not
-//! binaryninja::headless::init();
+//! let headless_session = binaryninja::headless::Session::new();
//!
//! println!("Loading binary...");
-//! let bv = binaryninja::load("/bin/cat").expect("Couldn't open `/bin/cat`");
+//! let bv = headless_session.load("/bin/cat").expect("Couldn't open `/bin/cat`");
//!
//! // Your code here...
-//!
-//! // Important! Standalone executables need to call shutdown or they will hang forever
-//! binaryninja::headless::shutdown();
//! }
//! ```
//!
@@ -123,7 +120,6 @@ extern crate rayon;
// cc possible values
// bv reorg
// core fileaccessor (for bv saving)
-// headless wrapper for shutdown
// platform cc
#[macro_use]
@@ -196,6 +192,7 @@ use string::BnStrCompatible;
const BN_FULL_CONFIDENCE: u8 = 255;
const BN_INVALID_EXPR: usize = usize::MAX;
+/// The main way to open and load files into Binary Ninja. Make sure you've properly initialized the core before calling this function. See [`crate::headless::init()`]
pub fn load<S: BnStrCompatible>(filename: S) -> Option<rc::Ref<binaryview::BinaryView>> {
let filename = filename.into_bytes_with_nul();
let metadata = Metadata::new_of_type(MetadataType::KeyValueDataType);
@@ -216,6 +213,8 @@ pub fn load<S: BnStrCompatible>(filename: S) -> Option<rc::Ref<binaryview::Binar
}
}
+/// The main way to open and load files (with options) into Binary Ninja. Make sure you've properly initialized the core before calling this function. See [`crate::headless::init()`]
+///
/// ```rust
/// let settings = [("analysis.linearSweep.autorun", false)].into();
///