From 9dadf92c16da5cd21def79ae39ca98803c9208ec Mon Sep 17 00:00:00 2001 From: Mason Reed Date: Mon, 5 May 2025 13:17:30 -0400 Subject: [Rust] Rename `AsCStr` to `IntoCStr` --- rust/src/collaboration.rs | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) (limited to 'rust/src/collaboration.rs') diff --git a/rust/src/collaboration.rs b/rust/src/collaboration.rs index 8a1774f2..9a97a0e8 100644 --- a/rust/src/collaboration.rs +++ b/rust/src/collaboration.rs @@ -30,7 +30,7 @@ pub use user::*; use binaryninjacore_sys::*; use crate::rc::{Array, Ref}; -use crate::string::{AsCStr, BnString}; +use crate::string::{BnString, IntoCStr}; // TODO: Should we pull metadata and information required to call a function? Or should we add documentation // TODO: on what functions need to have been called prior? I feel like we should make the user have to pull @@ -73,21 +73,21 @@ pub fn known_remotes() -> Array { } /// Get Remote by unique `id` -pub fn get_remote_by_id(id: S) -> Option> { +pub fn get_remote_by_id(id: S) -> Option> { let id = id.to_cstr(); let value = unsafe { BNCollaborationGetRemoteById(id.as_ptr()) }; NonNull::new(value).map(|h| unsafe { Remote::ref_from_raw(h) }) } /// Get Remote by `address` -pub fn get_remote_by_address(address: S) -> Option> { +pub fn get_remote_by_address(address: S) -> Option> { let address = address.to_cstr(); let value = unsafe { BNCollaborationGetRemoteByAddress(address.as_ptr()) }; NonNull::new(value).map(|h| unsafe { Remote::ref_from_raw(h) }) } /// Get Remote by `name` -pub fn get_remote_by_name(name: S) -> Option> { +pub fn get_remote_by_name(name: S) -> Option> { let name = name.to_cstr(); let value = unsafe { BNCollaborationGetRemoteByName(name.as_ptr()) }; NonNull::new(value).map(|h| unsafe { Remote::ref_from_raw(h) }) @@ -105,10 +105,10 @@ pub fn save_remotes() { pub fn store_data_in_keychain(key: K, data: I) -> bool where - K: AsCStr, + K: IntoCStr, I: IntoIterator, - DK: AsCStr, - DV: AsCStr, + DK: IntoCStr, + DV: IntoCStr, { let key = key.to_cstr(); let (data_keys, data_values): (Vec, Vec) = data @@ -127,12 +127,12 @@ where } } -pub fn has_data_in_keychain(key: K) -> bool { +pub fn has_data_in_keychain(key: K) -> bool { let key = key.to_cstr(); unsafe { BNCollaborationHasDataInKeychain(key.as_ptr()) } } -pub fn get_data_from_keychain(key: K) -> Option<(Array, Array)> { +pub fn get_data_from_keychain(key: K) -> Option<(Array, Array)> { let key = key.to_cstr(); let mut keys = std::ptr::null_mut(); let mut values = std::ptr::null_mut(); @@ -142,7 +142,7 @@ pub fn get_data_from_keychain(key: K) -> Option<(Array, Arr keys.zip(values) } -pub fn delete_data_from_keychain(key: K) -> bool { +pub fn delete_data_from_keychain(key: K) -> bool { let key = key.to_cstr(); unsafe { BNCollaborationDeleteDataFromKeychain(key.as_ptr()) } } -- cgit v1.3.1