Skip to content

Commit 43e5fb7

Browse files
committed
Remove unneeded script helper in rust api
1 parent 1b6b9a3 commit 43e5fb7

File tree

2 files changed

+2
-18
lines changed

2 files changed

+2
-18
lines changed

rust/src/headless.rs

+1-17
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,7 @@ use binaryninjacore_sys::{BNInitPlugins, BNInitRepoPlugins, BNSetBundledPluginDi
8080
///
8181
/// ⚠️ Important! Must be called at the beginning of scripts. Plugins do not need to call this. ⚠️
8282
///
83-
/// You can instead call this through [`Session`] or [`script_helper`]
83+
/// You can instead call this through [`Session`].
8484
pub fn init() {
8585
match crate::product().as_str() {
8686
"Binary Ninja Enterprise Client" | "Binary Ninja Ultimate" => {
@@ -118,22 +118,6 @@ pub fn is_shutdown_requested() -> bool {
118118
unsafe { binaryninjacore_sys::BNIsShutdownRequested() }
119119
}
120120

121-
/// Prelued-postlued helper function (calls [`init`] and [`shutdown`] for you)
122-
/// ```no_run
123-
/// # use binaryninja::binaryview::BinaryViewExt;
124-
/// binaryninja::headless::script_helper(|| {
125-
/// let cat = binaryninja::load("/bin/cat").expect("Couldn't open `/bin/cat`");
126-
/// for function in cat.functions().iter() {
127-
/// println!(" `{}`", function.symbol().full_name());
128-
/// }
129-
/// });
130-
/// ```
131-
pub fn script_helper(func: fn()) {
132-
init();
133-
func();
134-
shutdown();
135-
}
136-
137121
/// Wrapper for [`init`] and [`shutdown`]. Instantiating this at the top of your script will initialize everything correctly and then clean itself up at exit as well.
138122
pub struct Session {}
139123

rust/src/lib.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@
7272
//! The most up-to-date version of the suggested [`build.rs` is here].
7373
//!
7474
//! ### `main.rs`
75-
//! 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.
75+
//! Standalone binaries need to initialize Binary Ninja before they can work. You can do this through [`headless::Session`], or [`headless::init()`] at start and [`headless::shutdown()`] at shutdown.
7676
//! ```no_run
7777
//! // This loads all the core architecture, platform, etc plugins
7878
//! // Standalone executables need to call this, but plugins do not

0 commit comments

Comments
 (0)