pub struct FileChange {
pub path: PathBuf,
pub kind: ChangeKind,
pub content: Option<Vec<u8>>,
pub file_id: Option<FileId>,
pub blob: Option<GitOid>,
}Expand description
A single file change captured from a workspace.
For Added and Modified changes, content holds the new file bytes.
For Deleted changes, content is None.
file_id is the stable FileId assigned when the file was created. It
survives renames and modifications, enabling rename-aware merge (§5.8).
None if FileId tracking was not available at collect time.
blob is the git blob OID for the new content (computed via
git hash-object). Present for Added and Modified changes when the
collect step had access to the git repo. Enables O(1) hash-equality checks
in the resolve step without comparing raw bytes.
Fields§
§path: PathBufPath relative to the workspace root (and to the repo root).
kind: ChangeKindType of change.
content: Option<Vec<u8>>New file content (None for deletions).
file_id: Option<FileId>Stable file identity that persists across renames (§5.8).
None only for legacy artifacts and explicit test fixtures.
blob: Option<GitOid>Git blob OID for the new content (present for Add/Modify; None for
Delete and for changes collected without git access).
When populated, the resolve step uses OID equality instead of byte comparison for hash-equality checks, which is both faster and avoids loading content into memory.
Implementations§
Source§impl FileChange
impl FileChange
Sourcepub const fn new(
path: PathBuf,
kind: ChangeKind,
content: Option<Vec<u8>>,
) -> Self
pub const fn new( path: PathBuf, kind: ChangeKind, content: Option<Vec<u8>>, ) -> Self
Create a new FileChange without FileId or blob OID metadata.
Suitable for explicit legacy/test fixtures. Production collect paths
should prefer FileChange::with_identity.
Sourcepub const fn with_identity(
path: PathBuf,
kind: ChangeKind,
content: Option<Vec<u8>>,
file_id: Option<FileId>,
blob: Option<GitOid>,
) -> Self
pub const fn with_identity( path: PathBuf, kind: ChangeKind, content: Option<Vec<u8>>, file_id: Option<FileId>, blob: Option<GitOid>, ) -> Self
Create a new FileChange with full identity metadata.
Preferred constructor for Phase 3+ code paths where file_id and
blob OID are available from the workspace’s FileId map and git
object store.
Sourcepub const fn is_deletion(&self) -> bool
pub const fn is_deletion(&self) -> bool
Returns true if this change is a deletion.
Sourcepub const fn has_content(&self) -> bool
pub const fn has_content(&self) -> bool
Returns true if this change adds or modifies a file (has content).
Trait Implementations§
Source§impl Clone for FileChange
impl Clone for FileChange
Source§fn clone(&self) -> FileChange
fn clone(&self) -> FileChange
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for FileChange
impl Debug for FileChange
Source§impl PartialEq for FileChange
impl PartialEq for FileChange
impl Eq for FileChange
impl StructuralPartialEq for FileChange
Auto Trait Implementations§
impl Freeze for FileChange
impl RefUnwindSafe for FileChange
impl Send for FileChange
impl Sync for FileChange
impl Unpin for FileChange
impl UnsafeUnpin for FileChange
impl UnwindSafe for FileChange
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.