summaryrefslogtreecommitdiff
path: root/rust/src/settings.rs
diff options
context:
space:
mode:
authorMason Reed <mason@vector35.com>2025-05-12 12:06:22 -0400
committerMason Reed <35282038+emesare@users.noreply.github.com>2025-05-12 17:45:24 -0400
commitd5bac712c9fa269aaeb016648116d3147edf3855 (patch)
tree3fe6030d2576883b1762578bcd92ea8b450bf50a /rust/src/settings.rs
parent3b14d1605cf9ea638a0d058911a8c1e233a9f70d (diff)
[Rust] Misc cleanup
Diffstat (limited to 'rust/src/settings.rs')
-rw-r--r--rust/src/settings.rs10
1 files changed, 2 insertions, 8 deletions
diff --git a/rust/src/settings.rs b/rust/src/settings.rs
index 0047f570..3882ce4d 100644
--- a/rust/src/settings.rs
+++ b/rust/src/settings.rs
@@ -35,7 +35,7 @@ pub struct Settings {
}
impl Settings {
- pub(crate) unsafe fn from_raw(handle: *mut BNSettings) -> Ref<Self> {
+ pub(crate) unsafe fn ref_from_raw(handle: *mut BNSettings) -> Ref<Self> {
debug_assert!(!handle.is_null());
Ref::new(Self { handle })
}
@@ -46,11 +46,7 @@ impl Settings {
pub fn new_with_id(instance_id: &str) -> Ref<Self> {
let instance_id = instance_id.to_cstr();
- unsafe {
- let handle = BNCreateSettings(instance_id.as_ptr());
- debug_assert!(!handle.is_null());
- Ref::new(Self { handle })
- }
+ unsafe { Self::ref_from_raw(BNCreateSettings(instance_id.as_ptr())) }
}
pub fn set_resource_id(&self, resource_id: &str) {
@@ -84,8 +80,6 @@ impl Settings {
unsafe { Array::new(result as *mut *mut c_char, count, ()) }
}
- // TODO Update the settings API to take an optional BinaryView or Function. Separate functions or...?
-
pub fn get_bool(&self, key: &str) -> bool {
self.get_bool_with_opts(key, &mut QueryOptions::default())
}