summaryrefslogtreecommitdiff
path: root/rust/src
diff options
context:
space:
mode:
authorKyleMiles <krm504@nyu.edu>2024-05-28 18:06:59 -0400
committerKyleMiles <krm504@nyu.edu>2024-05-28 19:32:06 -0400
commitf6e5d78d2b3a92a9e793092f31ed8a81deb39751 (patch)
treed09750ea11d361f1118160e9f373c595942b859c /rust/src
parent9ca13512527ca62effce85bfcd9c41b8ed9cb86c (diff)
Rust API : recommend users use serde_json for when opening with options
Diffstat (limited to 'rust/src')
-rw-r--r--rust/src/lib.rs10
1 files changed, 8 insertions, 2 deletions
diff --git a/rust/src/lib.rs b/rust/src/lib.rs
index cb511a7a..1c2dacd0 100644
--- a/rust/src/lib.rs
+++ b/rust/src/lib.rs
@@ -217,13 +217,19 @@ 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()`]
///
-/// <div class="warning">Your JSON needs to be compliant with RapidJSON's format, which basically means you just need to escape double quotes (\") and single quotes won't work.</div>
+/// <div class="warning">Strict JSON doesn't support single quotes for strings, so you'll need to either use a raw strings (<code>f#"{"setting": "value"}"#</code>) or escape double quotes (<code>"{\"setting\": \"value\"}"</code>). Or use <code>serde_json::json</code>.</div>
///
/// ```no_run
+/// # // Mock implementation of json! macro for documentation purposes
+/// # macro_rules! json {
+/// # ($($arg:tt)*) => {
+/// # stringify!($($arg)*)
+/// # };
+/// # }
/// use binaryninja::{metadata::Metadata, rc::Ref};
/// use std::collections::HashMap;
///
-/// let bv = binaryninja::load_with_options("/bin/cat", true, Some("{\"analysis.linearSweep.autorun\": false}"))
+/// let bv = binaryninja::load_with_options("/bin/cat", true, Some(json!("analysis.linearSweep.autorun": false).to_string()))
/// .expect("Couldn't open `/bin/cat`");
/// ```
pub fn load_with_options<S: BnStrCompatible, O: IntoJson>(