Skip to content

Commit

Permalink
qlog: add explicit lifetime parameter to QlogSeqReader
Browse files Browse the repository at this point in the history
By adding an explicit lifetime parameter to QlogSeqReader the lifetime
of the Box'd BufReader's inner does not need to be 'static.
  • Loading branch information
hawkinsw authored Oct 22, 2024
1 parent 236a934 commit 88c9f2a
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions qlog/src/reader.rs
Original file line number Diff line number Diff line change
Expand Up @@ -40,14 +40,14 @@ pub enum Event {
/// trait.
///
/// [`BufRead`]: https://doc.rust-lang.org/std/io/trait.BufRead.html
pub struct QlogSeqReader {
pub struct QlogSeqReader<'a> {
pub qlog: QlogSeq,
reader: Box<dyn std::io::BufRead + Send + Sync>,
reader: Box<dyn std::io::BufRead + Send + Sync + 'a>,
}

impl QlogSeqReader {
impl<'a> QlogSeqReader<'a> {
pub fn new(
mut reader: Box<dyn std::io::BufRead + Send + Sync>,
mut reader: Box<dyn std::io::BufRead + Send + Sync + 'a>,
) -> Result<Self, Box<dyn std::error::Error>> {
// "null record" skip it
Self::read_record(reader.as_mut());
Expand Down Expand Up @@ -83,7 +83,7 @@ impl QlogSeqReader {
}
}

impl Iterator for QlogSeqReader {
impl<'a> Iterator for QlogSeqReader<'a> {
type Item = Event;

#[inline]
Expand Down

0 comments on commit 88c9f2a

Please sign in to comment.