From 53eed1fedbef8c778ba1ea03d6660a7f097886ca Mon Sep 17 00:00:00 2001 From: Rubens Brandao Date: Mon, 27 May 2024 17:45:25 -0300 Subject: allow `load_with_option` to accept json options --- rust/src/metadata.rs | 25 +++++++++++++++++++++++-- 1 file changed, 23 insertions(+), 2 deletions(-) (limited to 'rust/src/metadata.rs') diff --git a/rust/src/metadata.rs b/rust/src/metadata.rs index f635700f..96571207 100644 --- a/rust/src/metadata.rs +++ b/rust/src/metadata.rs @@ -1,5 +1,5 @@ -use crate::rc::{Array, CoreArrayProvider, Guard, CoreArrayProviderInner, Ref, RefCountable}; -use crate::string::{BnStrCompatible, BnString}; +use crate::rc::{Array, CoreArrayProvider, CoreArrayProviderInner, Guard, Ref, RefCountable}; +use crate::string::{BnStrCompatible, BnString, IntoJson}; use binaryninjacore_sys::*; use std::collections::HashMap; use std::os::raw::c_char; @@ -702,3 +702,24 @@ impl TryFrom<&Metadata> for HashMap> { .map(|m| m.into_iter().map(|(k, v)| (k.to_string(), v)).collect()) } } + +impl IntoJson for &Metadata { + type Output = BnString; + fn get_json_string(self) -> Result { + Metadata::get_json_string(self) + } +} + +impl IntoJson for Metadata { + type Output = BnString; + fn get_json_string(self) -> Result { + Metadata::get_json_string(&self) + } +} + +impl IntoJson for Ref { + type Output = BnString; + fn get_json_string(self) -> Result { + Metadata::get_json_string(&self) + } +} -- cgit v1.3.1