From f6e5d78d2b3a92a9e793092f31ed8a81deb39751 Mon Sep 17 00:00:00 2001 From: KyleMiles Date: Tue, 28 May 2024 18:06:59 -0400 Subject: Rust API : recommend users use serde_json for when opening with options --- rust/src/lib.rs | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) (limited to 'rust/src') 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(filename: S) -> OptionYour 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. +///
Strict JSON doesn't support single quotes for strings, so you'll need to either use a raw strings (f#"{"setting": "value"}"#) or escape double quotes ("{\"setting\": \"value\"}"). Or use serde_json::json.
/// /// ```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( -- cgit v1.3.1