Skip to main content

ObjectHasher

Struct ObjectHasher 

Source
pub struct ObjectHasher<'repo, R: Repository + ?Sized> { /* private fields */ }
Expand description

Resumable Git object hashing. Retain this value between step calls; it owns a cursor and hash state but no scratch. size_of::<ObjectHasher<'_, R>>() gives the exact inline state budget for a target. IDs include kind and size.

Implementations§

Source§

impl<'repo, R: Repository + ?Sized> ObjectHasher<'repo, R>

Source

pub fn new(repository: &'repo R, index: usize) -> Result<Self>

Source

pub fn position(&self) -> u64

Source

pub fn step(&mut self, scratch: &mut [u8]) -> Result<Option<ObjectId>>

Perform at most one provider read. None means more steps are needed; Some(id) means the declared body is complete. Completed calls repeat the same ID without rereading. Read errors leave the hash unchanged.

Source

pub fn finish(self, scratch: &mut [u8]) -> Result<ObjectId>

Hash the remaining body synchronously using only the supplied scratch.

Auto Trait Implementations§

§

impl<'repo, R> Freeze for ObjectHasher<'repo, R>
where ObjectReader<'repo, R>: Freeze, R: ?Sized,

§

impl<'repo, R> RefUnwindSafe for ObjectHasher<'repo, R>
where ObjectReader<'repo, R>: RefUnwindSafe, R: ?Sized,

§

impl<'repo, R> Send for ObjectHasher<'repo, R>
where ObjectReader<'repo, R>: Send, R: ?Sized,

§

impl<'repo, R> Sync for ObjectHasher<'repo, R>
where ObjectReader<'repo, R>: Sync, R: ?Sized,

§

impl<'repo, R> Unpin for ObjectHasher<'repo, R>
where ObjectReader<'repo, R>: Unpin, R: ?Sized,

§

impl<'repo, R> UnsafeUnpin for ObjectHasher<'repo, R>
where ObjectReader<'repo, R>: UnsafeUnpin, R: ?Sized,

§

impl<'repo, R> UnwindSafe for ObjectHasher<'repo, R>
where ObjectReader<'repo, R>: UnwindSafe, R: ?Sized,

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.