From d5bac712c9fa269aaeb016648116d3147edf3855 Mon Sep 17 00:00:00 2001 From: Mason Reed Date: Mon, 12 May 2025 12:06:22 -0400 Subject: [Rust] Misc cleanup --- rust/src/settings.rs | 10 ++-------- 1 file changed, 2 insertions(+), 8 deletions(-) (limited to 'rust/src/settings.rs') 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 { + pub(crate) unsafe fn ref_from_raw(handle: *mut BNSettings) -> Ref { debug_assert!(!handle.is_null()); Ref::new(Self { handle }) } @@ -46,11 +46,7 @@ impl Settings { pub fn new_with_id(instance_id: &str) -> Ref { 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()) } -- cgit v1.3.1