feat: add ArrayBuffer::from_raw_parts and from_raw_parts_shared for external buffers#683
Open
richarddd wants to merge 2 commits intoDelSkayn:masterfrom
Open
feat: add ArrayBuffer::from_raw_parts and from_raw_parts_shared for external buffers#683richarddd wants to merge 2 commits intoDelSkayn:masterfrom
richarddd wants to merge 2 commits intoDelSkayn:masterfrom
Conversation
30d0b0e to
5a27282
Compare
Sytten
requested changes
Apr 27, 2026
810e2f3 to
6794302
Compare
…external-buffer constructors with mutable, shared, and immutable variants
6794302 to
9bcc1a0
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Issue
N/A
Description of changes
Adds
ArrayBuffer::from_raw_parts(plainArrayBuffer) andArrayBuffer::from_raw_parts_shared(SharedArrayBuffer) for wrapping caller-owned memory with a customJSFreeArrayBufferDataFunc, enabling zero-copy exposure of Rust-owned byte storage (Arc<[u8]>,bytes::Bytes, memory maps, …) to JS;drop_fnis invoked synchronously on construction failure so the caller's buffer is released exactly once.Checklist