From d781bdbee8a7327661a56647231c4d4ece7f0074 Mon Sep 17 00:00:00 2001 From: Glenn Smith Date: Wed, 28 Sep 2022 21:30:49 -0400 Subject: [Rust API] Register settings --- rust/src/settings.rs | 42 +++++++++++++++++++++++++++++++++++++++--- 1 file changed, 39 insertions(+), 3 deletions(-) (limited to 'rust/src/settings.rs') diff --git a/rust/src/settings.rs b/rust/src/settings.rs index ba84acb7..0ae69e95 100644 --- a/rust/src/settings.rs +++ b/rust/src/settings.rs @@ -315,10 +315,10 @@ impl Settings { } } - pub fn set_string( + pub fn set_string( &self, - key: S, - value: S, + key: S1, + value: S2, view: Option<&BinaryView>, scope: Option, ) { @@ -410,6 +410,42 @@ impl Settings { ) } } + + pub fn register_group( + &self, + group: S1, + title: S2, + ) -> bool { + let group = group.into_bytes_with_nul(); + let title = title.into_bytes_with_nul(); + + unsafe { + BNSettingsRegisterGroup( + self.handle, + group.as_ref().as_ptr() as *mut _, + title.as_ref().as_ptr() as *mut _, + ) + } + } + + pub fn register_setting_json( + &self, + group: S1, + properties: S2, + ) -> bool { + let group = group.into_bytes_with_nul(); + let properties = properties.into_bytes_with_nul(); + + unsafe { + BNSettingsRegisterSetting( + self.handle, + group.as_ref().as_ptr() as *mut _, + properties.as_ref().as_ptr() as *mut _, + ) + } + } + + // TODO: register_setting but type-safely turn it into json } impl AsRef for Settings { -- cgit v1.3.1