diff options
| author | Mason Reed <mason@vector35.com> | 2025-05-04 19:10:56 -0400 |
|---|---|---|
| committer | Mason Reed <35282038+emesare@users.noreply.github.com> | 2025-05-12 17:45:24 -0400 |
| commit | a826c589dfc10c542deba7ca3343a462e02d6bde (patch) | |
| tree | f116254bef39f787268bbecc5eac19da310db9ce /rust/src/collaboration/folder.rs | |
| parent | 28b3c4044af06fdc32c9c85bf8381b5058306427 (diff) | |
[Rust] Simplify `BnStrCompatible` trait
Followup to https://github.com/Vector35/binaryninja-api/pull/5897/
This simplifies usage of the trait in user code, should just be able to `to_cstr` to get the cstr repr and then call `as_ptr`.
Co-authored-by: Michael Krasnitski <michael.krasnitski@gmail.com>
Diffstat (limited to 'rust/src/collaboration/folder.rs')
| -rw-r--r-- | rust/src/collaboration/folder.rs | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/rust/src/collaboration/folder.rs b/rust/src/collaboration/folder.rs index eb4fd9f8..0fd2bf87 100644 --- a/rust/src/collaboration/folder.rs +++ b/rust/src/collaboration/folder.rs @@ -5,7 +5,7 @@ use std::ptr::NonNull; use crate::project::folder::ProjectFolder; use crate::rc::{CoreArrayProvider, CoreArrayProviderInner, Guard, Ref, RefCountable}; -use crate::string::{BnStrCompatible, BnString}; +use crate::string::{AsCStr, BnString}; #[repr(transparent)] pub struct RemoteFolder { @@ -104,8 +104,8 @@ impl RemoteFolder { } /// Set the display name of the folder. You will need to push the folder to update the remote version. - pub fn set_name<S: BnStrCompatible>(&self, name: S) -> Result<(), ()> { - let name = name.into_bytes_with_nul(); + pub fn set_name<S: AsCStr>(&self, name: S) -> Result<(), ()> { + let name = name.to_cstr(); let success = unsafe { BNRemoteFolderSetName( self.handle.as_ptr(), @@ -123,8 +123,8 @@ impl RemoteFolder { } /// Set the description of the folder. You will need to push the folder to update the remote version. - pub fn set_description<S: BnStrCompatible>(&self, description: S) -> Result<(), ()> { - let description = description.into_bytes_with_nul(); + pub fn set_description<S: AsCStr>(&self, description: S) -> Result<(), ()> { + let description = description.to_cstr(); let success = unsafe { BNRemoteFolderSetDescription( self.handle.as_ptr(), |
