diff options
Diffstat (limited to 'rust/src/settings.rs')
| -rw-r--r-- | rust/src/settings.rs | 10 |
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()) } |
