History

git-commitgraph with a more convenient public interface with AsRef(#63)

Sebastian Thiel committed 5 years ago

Commit ba04e4e1 parent 0b729662 files · +6 −5Browse files

Showing the changes to git-commitgraph/src/file (1 of 2 files). Show all

Unified · Split

git-commitgraph/src/file/access.rs+2−1
@@ -70,7 +70,8 @@ impl File { · 69 unmodified lines
7070
7171 /// Translate the given object hash to its position within this file, if present.
7272 // copied from git-odb/src/pack/index/access.rs
73− pub fn lookup(&self, id: &git_hash::oid) -> Option<file::Position> {
73+ pub fn lookup(&self, id: impl AsRef<git_hash::oid>) -> Option<file::Position> {
74+ let id = id.as_ref();
7475 let first_byte = usize::from(id.first_byte());
7576 let mut upper_bound = self.fan[first_byte];
7677 let mut lower_bound = if first_byte != 0 { self.fan[first_byte - 1] } else { 0 };