Skip to content

Commit e6c6a7d

Browse files
authored
Add method for getting object refs of top-level objects of chunk (#40)
1 parent 07389e6 commit e6c6a7d

1 file changed

Lines changed: 6 additions & 0 deletions

File tree

src/chunk.rs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,12 @@ impl Chunk {
4747
.extend(other.offsets.iter().map(|&(id, offset)| (id, base + offset)));
4848
}
4949

50+
/// An iterator over the references of the top-level objects
51+
/// of the chunk, in the order they appear in the chunk.
52+
pub fn refs(&self) -> impl IntoIterator<Item = Ref> + '_ {
53+
self.offsets.iter().map(|&(id, _)| id)
54+
}
55+
5056
/// Renumbers the IDs of indirect objects and all indirect references in the
5157
/// chunk and returns the resulting chunk.
5258
///

0 commit comments

Comments
 (0)