summaryrefslogtreecommitdiff
path: root/rust/src/collaboration/user.rs
diff options
context:
space:
mode:
authorMason Reed <mason@vector35.com>2025-05-04 19:10:56 -0400
committerMason Reed <35282038+emesare@users.noreply.github.com>2025-05-12 17:45:24 -0400
commita826c589dfc10c542deba7ca3343a462e02d6bde (patch)
treef116254bef39f787268bbecc5eac19da310db9ce /rust/src/collaboration/user.rs
parent28b3c4044af06fdc32c9c85bf8381b5058306427 (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/user.rs')
-rw-r--r--rust/src/collaboration/user.rs10
1 files changed, 5 insertions, 5 deletions
diff --git a/rust/src/collaboration/user.rs b/rust/src/collaboration/user.rs
index b08e9da4..43b4e854 100644
--- a/rust/src/collaboration/user.rs
+++ b/rust/src/collaboration/user.rs
@@ -4,7 +4,7 @@ use std::ffi::c_char;
use std::ptr::NonNull;
use crate::rc::{CoreArrayProvider, CoreArrayProviderInner, Guard, Ref, RefCountable};
-use crate::string::{BnStrCompatible, BnString};
+use crate::string::{AsCStr, BnString};
#[repr(transparent)]
pub struct RemoteUser {
@@ -49,8 +49,8 @@ impl RemoteUser {
}
/// Set user's username. You will need to push the user to update the Remote
- pub fn set_username<U: BnStrCompatible>(&self, username: U) -> Result<(), ()> {
- let username = username.into_bytes_with_nul();
+ pub fn set_username<U: AsCStr>(&self, username: U) -> Result<(), ()> {
+ let username = username.to_cstr();
let result = unsafe {
BNCollaborationUserSetUsername(
self.handle.as_ptr(),
@@ -72,8 +72,8 @@ impl RemoteUser {
}
/// Set user's email. You will need to push the user to update the Remote
- pub fn set_email<U: BnStrCompatible>(&self, email: U) -> Result<(), ()> {
- let username = email.into_bytes_with_nul();
+ pub fn set_email<U: AsCStr>(&self, email: U) -> Result<(), ()> {
+ let username = email.to_cstr();
let result = unsafe {
BNCollaborationUserSetEmail(
self.handle.as_ptr(),