diff options
| author | Glenn Smith <glenn@vector35.com> | 2022-09-28 21:30:49 -0400 |
|---|---|---|
| committer | Glenn Smith <glenn@vector35.com> | 2022-09-29 21:02:25 -0400 |
| commit | d781bdbee8a7327661a56647231c4d4ece7f0074 (patch) | |
| tree | a6917b452b98b00fd06121a1f9c34270685de66e /rust/src | |
| parent | 7c3aaa056a98cbcbc3c2ce3ce3a8bc30238af151 (diff) | |
[Rust API] Register settings
Diffstat (limited to 'rust/src')
| -rw-r--r-- | rust/src/settings.rs | 42 |
1 files changed, 39 insertions, 3 deletions
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<S: BnStrCompatible>( + pub fn set_string<S1: BnStrCompatible, S2: BnStrCompatible>( &self, - key: S, - value: S, + key: S1, + value: S2, view: Option<&BinaryView>, scope: Option<SettingsScope>, ) { @@ -410,6 +410,42 @@ impl Settings { ) } } + + pub fn register_group<S1: BnStrCompatible, S2: BnStrCompatible>( + &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<S1: BnStrCompatible, S2: BnStrCompatible>( + &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<Settings> for Settings { |
