diff options
Diffstat (limited to 'rust/src/collaboration/merge.rs')
| -rw-r--r-- | rust/src/collaboration/merge.rs | 18 |
1 files changed, 9 insertions, 9 deletions
diff --git a/rust/src/collaboration/merge.rs b/rust/src/collaboration/merge.rs index 68bfdc02..84aa6192 100644 --- a/rust/src/collaboration/merge.rs +++ b/rust/src/collaboration/merge.rs @@ -5,7 +5,7 @@ use std::ptr::NonNull; use crate::database::{snapshot::Snapshot, Database}; use crate::file_metadata::FileMetadata; use crate::rc::{CoreArrayProvider, CoreArrayProviderInner, Guard, Ref, RefCountable}; -use crate::string::{BnStrCompatible, BnString}; +use crate::string::{AsCStr, BnString}; pub type MergeConflictDataType = BNMergeConflictDataType; @@ -49,8 +49,8 @@ impl MergeConflict { NonNull::new(result).map(|handle| unsafe { Snapshot::from_raw(handle) }) } - pub fn path_item_string<S: BnStrCompatible>(&self, path: S) -> Result<BnString, ()> { - let path = path.into_bytes_with_nul(); + pub fn path_item_string<S: AsCStr>(&self, path: S) -> Result<BnString, ()> { + let path = path.to_cstr(); let result = unsafe { BNAnalysisMergeConflictGetPathItemString( self.handle.as_ptr(), @@ -123,8 +123,8 @@ impl MergeConflict { } /// Call this when you've resolved the conflict to save the result - pub fn success<S: BnStrCompatible>(&self, value: S) -> Result<(), ()> { - let value = value.into_bytes_with_nul(); + pub fn success<S: AsCStr>(&self, value: S) -> Result<(), ()> { + let value = value.to_cstr(); let success = unsafe { BNAnalysisMergeConflictSuccess( self.handle.as_ptr(), @@ -135,8 +135,8 @@ impl MergeConflict { } // TODO: Make a safe version of this that checks the path and if it holds a number - pub unsafe fn get_path_item_number<S: BnStrCompatible>(&self, path_key: S) -> Option<u64> { - let path_key = path_key.into_bytes_with_nul(); + pub unsafe fn get_path_item_number<S: AsCStr>(&self, path_key: S) -> Option<u64> { + let path_key = path_key.to_cstr(); let value = unsafe { BNAnalysisMergeConflictGetPathItem( self.handle.as_ptr(), @@ -150,8 +150,8 @@ impl MergeConflict { } } - pub unsafe fn get_path_item_string<S: BnStrCompatible>(&self, path_key: S) -> Option<BnString> { - let path_key = path_key.into_bytes_with_nul(); + pub unsafe fn get_path_item_string<S: AsCStr>(&self, path_key: S) -> Option<BnString> { + let path_key = path_key.to_cstr(); let value = unsafe { BNAnalysisMergeConflictGetPathItemString( self.handle.as_ptr(), |
