Skip to content

Commit

Permalink
implement IntoIterator for InitialNalUnits
Browse files Browse the repository at this point in the history
  • Loading branch information
astraw committed Dec 6, 2024
1 parent e784bdf commit 65e8e3b
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions src/nal_unit.rs
Original file line number Diff line number Diff line change
Expand Up @@ -279,9 +279,10 @@ pub struct InitialNalUnits {
pub frame: NalUnit,
}

impl InitialNalUnits {
/// Return an [Iterator] over the NAL units generated at the start of encoding.
pub fn into_iter(self) -> impl Iterator<Item = NalUnit> {
impl std::iter::IntoIterator for InitialNalUnits {
type Item = NalUnit;
type IntoIter = alloc::vec::IntoIter<Self::Item>;
fn into_iter(self) -> Self::IntoIter {
vec![self.sps, self.pps, self.frame].into_iter()
}
}

0 comments on commit 65e8e3b

Please sign in to comment.