Struct git_commitgraph::file::File[][src]

pub struct File { /* fields omitted */ }

A single commit-graph file.

All operations on a File are local to that graph file. Since a commit graph can span multiple files, all interesting graph operations belong on Graph.

Implementations

impl File[src]

Access

pub fn base_graph_count(&self) -> u8[src]

The number of base graphs that this file depends on.

pub fn commit_at(&self, pos: Position) -> Commit<'_>[src]

Returns the commit data for the commit located at the given lexigraphical position.

pos must range from 0 to self.num_commits().

Panics

Panics if pos is out of bounds.

pub fn hash_kind(&self) -> HashKind[src]

The kind of hash used in this File.

Note that it is always conforming to the hash used in the owning repository.

pub fn id_at(&self, pos: Position) -> Id<'_>[src]

Returns 20 bytes sha1 at the given index in our list of (sorted) sha1 hashes. The position ranges from 0 to self.num_commits()

pub fn iter_base_graph_ids(&self) -> impl Iterator<Item = Id<'_>>[src]

Return an iterator over all object hashes stored in the base graph.

pub fn iter_commits(&self) -> impl Iterator<Item = Commit<'_>>[src]

return an iterator over all commits in this file.

pub fn iter_ids(&self) -> impl Iterator<Item = Id<'_>>[src]

Return an iterator over all object hashes stored in this file.

pub fn lookup(&self, id: Id<'_>) -> Option<Position>[src]

Translate the given object hash to its position within this file, if present.

pub fn num_commits(&self) -> u32[src]

Returns the number of commits in this graph file.

The maximum valid file::Position that can be used with this file is one less than num_commits().

pub fn path(&self) -> &Path[src]

Returns the path to this file.

impl File[src]

pub fn at(path: impl AsRef<Path>) -> Result<File, Error>[src]

Try to parse the commit graph file at path.

impl File[src]

Verification

pub fn checksum(&self) -> Id<'_>[src]

Returns the trailing checksum over the entire content of this file.

pub fn traverse<'a, E, Processor>(
    &'a self,
    mut processor: Processor
) -> Result<Outcome, Error<E>> where
    E: Error + 'static,
    Processor: FnMut(&Commit<'a>) -> Result<(), E>, 
[src]

Traverse all commits stored in this file and call processor(commit) -> Result<(), Error> on it.

If the processor fails, the iteration will be stopped and the entire call results in the respective error.

pub fn verify_checksum(&self) -> Result<Id, (Id, Id)>[src]

Assure the checksum matches the actual checksum over all content of this file, excluding the trailing checksum itself.

Return the actual checksum on success or (actual checksum, expected checksum) if there is a mismatch.

Trait Implementations

impl Debug for File[src]

impl TryFrom<&'_ Path> for File[src]

type Error = Error

The type returned in the event of a conversion error.

Auto Trait Implementations

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> Conv for T

impl<T> Conv for T

impl<T> FmtForward for T

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> Pipe for T where
    T: ?Sized

impl<T> Pipe for T

impl<T> PipeAsRef for T

impl<T> PipeBorrow for T

impl<T> PipeDeref for T

impl<T> PipeRef for T

impl<T> Tap for T

impl<T> Tap for T

impl<T, U> TapAsRef<U> for T where
    U: ?Sized

impl<T, U> TapBorrow<U> for T where
    U: ?Sized

impl<T> TapDeref for T

impl<T> TryConv for T

impl<T> TryConv for T

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

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

The type returned in the event of a conversion error.