Skip to main content

IndexEntry

Enum IndexEntry 

Source
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§

§

Set

Fields

§mode: String
§path: Vec<u8>
§

Remove

Fields

§path: Vec<u8>

Implementations§

Source§

impl IndexEntry

Source

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§

Source§

impl Debug for IndexEntry

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.