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

Add lifetime to Section references #699

Merged
merged 1 commit into from
Mar 9, 2024
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
8 changes: 4 additions & 4 deletions src/write/section.rs
Original file line number Diff line number Diff line change
Expand Up @@ -121,9 +121,9 @@ impl<W: Writer + Clone> Sections<W> {

impl<W: Writer> Sections<W> {
/// For each section, call `f` once with a shared reference.
pub fn for_each<F, E>(&self, mut f: F) -> result::Result<(), E>
pub fn for_each<'a, F, E>(&'a self, mut f: F) -> result::Result<(), E>
where
F: FnMut(SectionId, &W) -> result::Result<(), E>,
F: FnMut(SectionId, &'a W) -> result::Result<(), E>,
{
macro_rules! f {
($s:expr) => {
Expand All @@ -146,9 +146,9 @@ impl<W: Writer> Sections<W> {
}

/// For each section, call `f` once with a mutable reference.
pub fn for_each_mut<F, E>(&mut self, mut f: F) -> result::Result<(), E>
pub fn for_each_mut<'a, F, E>(&'a mut self, mut f: F) -> result::Result<(), E>
where
F: FnMut(SectionId, &mut W) -> result::Result<(), E>,
F: FnMut(SectionId, &'a mut W) -> result::Result<(), E>,
{
macro_rules! f {
($s:expr) => {
Expand Down
Loading