pub enum IndexEntry {
Set {
mode: String,
oid: String,
path: Vec<u8>,
},
Remove {
path: Vec<u8>,
},
}Expand description
One record to feed a scratch index.
Owned rather than borrowed: a text file’s oid is produced by
ObjectWriter::write_blob inside the staging loop and would not outlive a
borrow. One allocation per changed file is free next to the subprocess it
is about to be piped into.
Variants§
Implementations§
Source§impl IndexEntry
impl IndexEntry
Sourcepub fn from_staged(
staged: Staged<'_>,
path: Vec<u8>,
write: impl FnOnce() -> Result<String, EngineError>,
) -> Result<IndexEntry, EngineError>
pub fn from_staged( staged: Staged<'_>, path: Vec<u8>, write: impl FnOnce() -> Result<String, EngineError>, ) -> Result<IndexEntry, EngineError>
The index record a staging decision implies.
Remove and Recorded need nothing beyond the decision. Apply needs
content written, and only the caller knows how — from a blob read fresh
or one it has memoised — so write is asked for the oid then, and never
otherwise. The three tree builders used to spell all three arms out for
themselves, and agreed only by inspection.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for IndexEntry
impl RefUnwindSafe for IndexEntry
impl Send for IndexEntry
impl Sync for IndexEntry
impl Unpin for IndexEntry
impl UnsafeUnpin for IndexEntry
impl UnwindSafe for IndexEntry
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