Skip to content

Add CustomSectionReader -> BinaryReader conversion#2550

Merged
alexcrichton merged 1 commit into
bytecodealliance:mainfrom
WorldSEnder:custom-section-reader
Jun 30, 2026
Merged

Add CustomSectionReader -> BinaryReader conversion#2550
alexcrichton merged 1 commit into
bytecodealliance:mainfrom
WorldSEnder:custom-section-reader

Conversation

@WorldSEnder

Copy link
Copy Markdown
Contributor

Construction by hand does not preserve features field of the parser.

This also shrinks the parser to the remaining data. Passing the reader as a field of KnownCustom::Unknown would break consumers, hence this is a standalone method here. The recommended approach is thus to use it as

match custom.name() {
  "my-interesting-custom-section" => foo(custom.data_reader()),
  _ => {},
}

Construction by hand does not preserve features of the parser.
This also shrinks the parser to the remaining data.
Passing it in the enum as a field of KnownCustom::Unknown would
break consumers. The recommended approach is thus to use it as

match custom.name() {
  "my-interesting-custom-section" => foo(custom.data_reader()),
  _ => {},
}
@WorldSEnder WorldSEnder requested a review from a team as a code owner June 30, 2026 15:02
@WorldSEnder WorldSEnder requested review from pchickey and removed request for a team June 30, 2026 15:02

@alexcrichton alexcrichton left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks!

@alexcrichton alexcrichton added this pull request to the merge queue Jun 30, 2026
Merged via the queue into bytecodealliance:main with commit 41cf129 Jun 30, 2026
37 checks passed
@WorldSEnder WorldSEnder deleted the custom-section-reader branch June 30, 2026 16:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants