Skip to content

Commit 282e0a9

Browse files
committed
[Rust] Fix misc improper collaboration project function signatures
We should not be using Ref<T> in functions which do not require ref counted ownership Also changes `Project::default_project_path` to return `PathBuf`
1 parent 623a1fe commit 282e0a9

1 file changed

Lines changed: 6 additions & 5 deletions

File tree

rust/src/collaboration/project.rs

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -766,7 +766,7 @@ impl RemoteProject {
766766
/// # Arguments
767767
///
768768
/// * `user` - User to check
769-
pub fn can_user_view(&self, user: Ref<RemoteUser>) -> bool {
769+
pub fn can_user_view(&self, user: &RemoteUser) -> bool {
770770
unsafe { BNRemoteProjectCanUserView(self.handle.as_ptr(), user.handle.as_ptr()) }
771771
}
772772

@@ -775,7 +775,7 @@ impl RemoteProject {
775775
/// # Arguments
776776
///
777777
/// * `user` - User to check
778-
pub fn can_user_edit(&self, user: Ref<RemoteUser>) -> bool {
778+
pub fn can_user_edit(&self, user: &RemoteUser) -> bool {
779779
unsafe { BNRemoteProjectCanUserEdit(self.handle.as_ptr(), user.handle.as_ptr()) }
780780
}
781781

@@ -784,16 +784,17 @@ impl RemoteProject {
784784
/// # Arguments
785785
///
786786
/// * `user` - User to check
787-
pub fn can_user_admin(&self, user: Ref<RemoteUser>) -> bool {
787+
pub fn can_user_admin(&self, user: &RemoteUser) -> bool {
788788
unsafe { BNRemoteProjectCanUserAdmin(self.handle.as_ptr(), user.handle.as_ptr()) }
789789
}
790790

791791
/// Get the default directory path for a remote Project. This is based off
792792
/// the Setting for collaboration.directory, the project's id, and the
793793
/// project's remote's id.
794-
pub fn default_project_path(&self) -> String {
794+
pub fn default_project_path(&self) -> PathBuf {
795795
let result = unsafe { BNCollaborationDefaultProjectPath(self.handle.as_ptr()) };
796-
unsafe { BnString::into_string(result) }
796+
let result_str = unsafe { BnString::into_string(result) };
797+
PathBuf::from(result_str)
797798
}
798799

799800
/// Upload a file, with database, to the remote under the given project

0 commit comments

Comments
 (0)