Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix lifetimes of outputs for Patch #1141

Merged
merged 1 commit into from
Mar 12, 2025
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 5 additions & 5 deletions src/patch.rs
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,7 @@ impl<'buffers> Patch<'buffers> {
}

/// Get the DiffDelta associated with the Patch.
pub fn delta(&self) -> DiffDelta<'buffers> {
pub fn delta<'a>(&'a self) -> DiffDelta<'a> {
unsafe { Binding::from_raw(raw::git_patch_get_delta(self.raw) as *mut _) }
}

Expand All @@ -151,7 +151,7 @@ impl<'buffers> Patch<'buffers> {
}

/// Get a DiffHunk and its total line count from the Patch.
pub fn hunk(&self, hunk_idx: usize) -> Result<(DiffHunk<'buffers>, usize), Error> {
pub fn hunk<'a>(&'a self, hunk_idx: usize) -> Result<(DiffHunk<'a>, usize), Error> {
let mut ret = ptr::null();
let mut lines = 0;
unsafe {
Expand All @@ -168,11 +168,11 @@ impl<'buffers> Patch<'buffers> {
}

/// Get a DiffLine from a hunk of the Patch.
pub fn line_in_hunk(
&self,
pub fn line_in_hunk<'a>(
&'a self,
hunk_idx: usize,
line_of_hunk: usize,
) -> Result<DiffLine<'buffers>, Error> {
) -> Result<DiffLine<'a>, Error> {
let mut ret = ptr::null();
unsafe {
try_call!(raw::git_patch_get_line_in_hunk(
Expand Down