Skip to content

Commit

Permalink
feat: implement FusedIterator for SubParser & VobsubParser
Browse files Browse the repository at this point in the history
  • Loading branch information
gwen-lg committed Mar 8, 2025
1 parent 15b889d commit ee53f2d
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 1 deletion.
8 changes: 8 additions & 0 deletions src/pgs/sup.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ use super::{PgsDecoder, PgsError};
use std::{
fs::{self, File},
io::{BufRead, BufReader, Seek},
iter::FusedIterator,
marker::PhantomData,
path::Path,
};
Expand Down Expand Up @@ -63,6 +64,13 @@ where
}
}

impl<Reader, Decoder> FusedIterator for SupParser<Reader, Decoder>
where
Reader: BufRead + Seek,
Decoder: PgsDecoder,
{
}

#[cfg(test)]
mod tests {
use super::SupParser;
Expand Down
3 changes: 2 additions & 1 deletion src/vobsub/sub.rs
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ use nom::{
sequence::{preceded, Tuple},
IResult,
};
use std::{cmp::Ordering, fmt::Debug, marker::PhantomData};
use std::{cmp::Ordering, fmt::Debug, iter::FusedIterator, marker::PhantomData};
use thiserror::Error;

/// Parse four 4-bit palette entries.
Expand Down Expand Up @@ -412,6 +412,7 @@ impl<D> Iterator for VobsubParser<'_, D> {
Some(subtitle)
}
}
impl<D> FusedIterator for VobsubParser<'_, D> {}

#[cfg(test)]
mod tests {
Expand Down

0 comments on commit ee53f2d

Please sign in to comment.