pub struct ConflictFile {
pub hash_length: usize,
}Expand description
Conflict-file resolution (recommended for peer sync)
When a conflict is detected, renames the incoming file to include a version
suffix based on the content hash: <name>@<short-hash>.<ext>.
This preserves both versions:
- The base (local) operation wins and keeps the original path
- The incoming operation is renamed to a conflict file with its content version
Users can then manually review and resolve the conflict files.
§Example
If document.txt conflicts and incoming has content hash abc123...:
- Local version stays at
document.txt - Incoming version becomes
document@abc123de.txt
Fields§
§hash_length: usizeNumber of hex characters to use from the hash (default: 8)
Implementations§
Source§impl ConflictFile
impl ConflictFile
Sourcepub fn with_hash_length(hash_length: usize) -> Self
pub fn with_hash_length(hash_length: usize) -> Self
Create a new ConflictFile resolver with custom hash length
Sourcepub fn conflict_path(path: &Path, version: &str) -> PathBuf
pub fn conflict_path(path: &Path, version: &str) -> PathBuf
Generate a conflict filename using a version string
Format: <name>@<version> (extension precedes the @)
Examples: config.toml@abc123de, README@abc123de
Trait Implementations§
Source§impl Clone for ConflictFile
impl Clone for ConflictFile
Source§fn clone(&self) -> ConflictFile
fn clone(&self) -> ConflictFile
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl ConflictResolver for ConflictFile
impl ConflictResolver for ConflictFile
Source§impl Debug for ConflictFile
impl Debug for ConflictFile
Source§impl Default for ConflictFile
impl Default for ConflictFile
Source§fn default() -> ConflictFile
fn default() -> ConflictFile
Returns the “default value” for a type. Read more
Auto Trait Implementations§
impl Freeze for ConflictFile
impl RefUnwindSafe for ConflictFile
impl Send for ConflictFile
impl Sync for ConflictFile
impl Unpin for ConflictFile
impl UnwindSafe for ConflictFile
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more