From e6c6a7dbfa19f9166c3c0dd2d1847c64f75c3b48 Mon Sep 17 00:00:00 2001 From: Laurenz Stampfl <47084093+LaurenzV@users.noreply.github.com> Date: Sun, 1 Sep 2024 13:12:27 +0200 Subject: [PATCH] Add method for getting object refs of top-level objects of chunk (#40) --- src/chunk.rs | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/chunk.rs b/src/chunk.rs index dcdede9..102eed7 100644 --- a/src/chunk.rs +++ b/src/chunk.rs @@ -47,6 +47,12 @@ impl Chunk { .extend(other.offsets.iter().map(|&(id, offset)| (id, base + offset))); } + /// An iterator over the references of the top-level objects + /// of the chunk, in the order they appear in the chunk. + pub fn refs(&self) -> impl IntoIterator + '_ { + self.offsets.iter().map(|&(id, _)| id) + } + /// Renumbers the IDs of indirect objects and all indirect references in the /// chunk and returns the resulting chunk. ///