Struct git_commitgraph::graph::Graph
source · [−]pub struct Graph { /* private fields */ }
Expand description
A complete commit graph.
The data in the commit graph may come from a monolithic objects/info/commit-graph
file, or it
may come from one or more objects/info/commit-graphs/graph-*.graph
files. These files are
generated via git commit-graph write ...
commands.
Implementations
sourceimpl Graph
impl Graph
Access
sourcepub fn commit_by_id(&self, id: impl AsRef<oid>) -> Option<Commit<'_>>
pub fn commit_by_id(&self, id: impl AsRef<oid>) -> Option<Commit<'_>>
Returns the commit matching the given id
.
sourcepub fn iter_commits(&self) -> impl Iterator<Item = Commit<'_>>
pub fn iter_commits(&self) -> impl Iterator<Item = Commit<'_>>
Iterate over commits in unsorted order.
sourcepub fn iter_ids(&self) -> impl Iterator<Item = &oid>
pub fn iter_ids(&self) -> impl Iterator<Item = &oid>
Iterate over commit IDs in unsorted order.
sourcepub fn lookup(&self, id: impl AsRef<oid>) -> Option<Position>
pub fn lookup(&self, id: impl AsRef<oid>) -> Option<Position>
Translate the given id
to its position in the file.
sourcepub fn num_commits(&self) -> u32
pub fn num_commits(&self) -> u32
Returns the number of commits stored in this file.
sourceimpl Graph
impl Graph
Instantiate a Graph
from various sources.
sourcepub fn at(path: impl AsRef<Path>) -> Result<Self, Error>
pub fn at(path: impl AsRef<Path>) -> Result<Self, Error>
Instantiate a commit graph from path
which may be a directory containing graph files or the graph file itself.
sourcepub fn from_commit_graphs_dir(path: impl AsRef<Path>) -> Result<Self, Error>
pub fn from_commit_graphs_dir(path: impl AsRef<Path>) -> Result<Self, Error>
Instantiate a commit graph from the directory containing all of its files.
sourcepub fn from_file(path: impl AsRef<Path>) -> Result<Self, Error>
pub fn from_file(path: impl AsRef<Path>) -> Result<Self, Error>
Instantiate a commit graph from a .git/objects/info/commit-graph
or
.git/objects/info/commit-graphs/graph-*.graph
file.
sourcepub fn from_info_dir(info_dir: impl AsRef<Path>) -> Result<Self, Error>
pub fn from_info_dir(info_dir: impl AsRef<Path>) -> Result<Self, Error>
Instantiate a commit graph from an .git/objects/info
directory.
sourceimpl Graph
impl Graph
sourcepub fn verify_integrity<E>(
&self,
processor: impl FnMut(&Commit<'_>) -> Result<(), E>
) -> Result<Outcome, Error<E>> where
E: Error + 'static,
pub fn verify_integrity<E>(
&self,
processor: impl FnMut(&Commit<'_>) -> Result<(), E>
) -> Result<Outcome, Error<E>> where
E: Error + 'static,
Traverse all commits in the graph and call processor(&commit) -> Result<(), E>
on it while verifying checksums.
When processor
returns an error, the entire verification is stopped and the error returned.
Trait Implementations
Auto Trait Implementations
impl RefUnwindSafe for Graph
impl Send for Graph
impl Sync for Graph
impl Unpin for Graph
impl UnwindSafe for Graph
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more