Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add method for getting object refs of top-level objects of chunk #40

Merged
merged 2 commits into from
Sep 1, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions src/chunk.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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<Item = Ref> + '_ {
self.offsets.iter().map(|&(id, _)| id)
}

/// Renumbers the IDs of indirect objects and all indirect references in the
/// chunk and returns the resulting chunk.
///
Expand Down