Skip to content

Remove generic Stream and StreamError types#276

Merged
MaxDesiatov merged 5 commits into
mainfrom
maxd/specialize-bytestream
Jan 18, 2026
Merged

Remove generic Stream and StreamError types#276
MaxDesiatov merged 5 commits into
mainfrom
maxd/specialize-bytestream

Conversation

@MaxDesiatov
Copy link
Copy Markdown
Member

@MaxDesiatov MaxDesiatov commented Jan 18, 2026

Both Stream and StreamError are over-generalization of generic streams, while only ByteStream is actually used in WasmParser, and StreamError is always used with UInt8 type parameter.

Let's clean these up as unused, WasmParser is not in the business of providing general stream APIs.

StreamError is now merged with WasmParserError, which simplifies future adoption of typed throws to unblock #273.

While we're at it, ByteStream now conforms to ~Copyable, but ideally we'd want it to return Span<UInt8> and not ArraySlice from its methods. Bumping required Swift version to 6.2 is required for that, which we're not ready to do just yet, so ~Escapable constraint is not added in this PR.

Comment thread Sources/WasmParser/WasmParser.swift
Comment thread Sources/WasmParser/WasmParser.swift Outdated
Comment thread Sources/WasmParser/WasmParser.swift
@MaxDesiatov MaxDesiatov merged commit 06e88c2 into main Jan 18, 2026
22 of 23 checks passed
@MaxDesiatov MaxDesiatov deleted the maxd/specialize-bytestream branch January 18, 2026 18:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants