That way it's in line with 'graph::Position'
Showing the changes to git-commitgraph/src/graph (1 of 6 files). Show all
Unified · Split
| @@ -1,12 +1,12 @@ | ||
| 1 | 1 | use crate::{ |
| 2 | − file::{Commit, File, LexPosition}, | |
| 3 | − graph::{Graph, Position}, | |
| 2 | + file::{self, Commit, File}, | |
| 3 | + graph::{self, Graph}, | |
| 4 | 4 | }; |
| 5 | 5 | use git_object::borrowed; |
| 6 | 6 | |
| 7 | −/// Access convenience | |
| 7 | +/// Access | |
| 8 | 8 | impl Graph { |
| 9 | − pub fn commit_at(&self, pos: Position) -> Commit<'_> { | |
| 9 | + pub fn commit_at(&self, pos: graph::Position) -> Commit<'_> { | |
| 10 | 10 | let r = self.lookup_by_pos(pos); |
| 11 | 11 | r.file.commit_at(r.lex_pos) |
| 12 | 12 | } |
| @@ -16,7 +16,7 @@ impl Graph { · 3 unmodified lines | ||
| 16 | 16 | Some(r.file.commit_at(r.lex_pos)) |
| 17 | 17 | } |
| 18 | 18 | |
| 19 | − pub fn id_at(&self, pos: Position) -> borrowed::Id<'_> { | |
| 19 | + pub fn id_at(&self, pos: graph::Position) -> borrowed::Id<'_> { | |
| 20 | 20 | let r = self.lookup_by_pos(pos); |
| 21 | 21 | r.file.id_at(r.lex_pos) |
| 22 | 22 | } |
| @@ -31,7 +31,7 @@ impl Graph { · 8 unmodified lines | ||
| 31 | 31 | self.files.iter().flat_map(|file| file.iter_ids()) |
| 32 | 32 | } |
| 33 | 33 | |
| 34 | − pub fn lookup(&self, id: borrowed::Id<'_>) -> Option<Position> { | |
| 34 | + pub fn lookup(&self, id: borrowed::Id<'_>) -> Option<graph::Position> { | |
| 35 | 35 | Some(self.lookup_by_id(id)?.graph_pos) |
| 36 | 36 | } |
| 37 | 37 | |
| @@ -49,7 +49,7 @@ impl Graph { · 11 unmodified lines | ||
| 49 | 49 | return Some(LookupByIdResult { |
| 50 | 50 | file, |
| 51 | 51 | lex_pos, |
| 52 | − graph_pos: Position(current_file_start + lex_pos.0), | |
| 52 | + graph_pos: graph::Position(current_file_start + lex_pos.0), | |
| 53 | 53 | }); |
| 54 | 54 | } |
| 55 | 55 | current_file_start += file.num_commits(); |
| @@ -57,7 +57,7 @@ impl Graph { · 1 unmodified line | ||
| 57 | 57 | None |
| 58 | 58 | } |
| 59 | 59 | |
| 60 | − fn lookup_by_pos(&self, pos: Position) -> LookupByPositionResult<'_> { | |
| 60 | + fn lookup_by_pos(&self, pos: graph::Position) -> LookupByPositionResult<'_> { | |
| 61 | 61 | let mut remaining = pos.0; |
| 62 | 62 | for file in &self.files { |
| 63 | 63 | match remaining.checked_sub(file.num_commits()) { |
| @@ -65,7 +65,7 @@ impl Graph { · 1 unmodified line | ||
| 65 | 65 | None => { |
| 66 | 66 | return LookupByPositionResult { |
| 67 | 67 | file, |
| 68 | − lex_pos: LexPosition(remaining), | |
| 68 | + lex_pos: file::Position(remaining), | |
| 69 | 69 | } |
| 70 | 70 | } |
| 71 | 71 | } |
| @@ -77,12 +77,12 @@ impl Graph { · 5 unmodified lines | ||
| 77 | 77 | #[derive(Clone)] |
| 78 | 78 | struct LookupByIdResult<'a> { |
| 79 | 79 | pub file: &'a File, |
| 80 | − pub graph_pos: Position, | |
| 81 | − pub lex_pos: LexPosition, | |
| 80 | + pub graph_pos: graph::Position, | |
| 81 | + pub lex_pos: file::Position, | |
| 82 | 82 | } |
| 83 | 83 | |
| 84 | 84 | #[derive(Clone)] |
| 85 | 85 | struct LookupByPositionResult<'a> { |
| 86 | 86 | pub file: &'a File, |
| 87 | − pub lex_pos: LexPosition, | |
| 87 | + pub lex_pos: file::Position, | |
| 88 | 88 | } |