diff options
| author | Rubens Brandao <git@rubens.io> | 2024-05-27 17:45:25 -0300 |
|---|---|---|
| committer | KyleMiles <krm504@nyu.edu> | 2024-05-28 17:11:23 -0400 |
| commit | 53eed1fedbef8c778ba1ea03d6660a7f097886ca (patch) | |
| tree | af3bedbd282f57a54a846afc847eea6cf1eb0064 /rust/src/metadata.rs | |
| parent | fbf782fcd84aa77f8765589bdda491646a957044 (diff) | |
allow `load_with_option` to accept json options
Diffstat (limited to 'rust/src/metadata.rs')
| -rw-r--r-- | rust/src/metadata.rs | 25 |
1 files changed, 23 insertions, 2 deletions
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<String, Ref<Metadata>> { .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<BnString, ()> { + Metadata::get_json_string(self) + } +} + +impl IntoJson for Metadata { + type Output = BnString; + fn get_json_string(self) -> Result<BnString, ()> { + Metadata::get_json_string(&self) + } +} + +impl IntoJson for Ref<Metadata> { + type Output = BnString; + fn get_json_string(self) -> Result<BnString, ()> { + Metadata::get_json_string(&self) + } +} |
