Skip to content

Conversation

@anonrig
Copy link
Member

@anonrig anonrig commented Jan 12, 2026

Adds array support to the Rust/JSG layer.

  • We now support Vec as function parameters where T is a primitive (such as boolean etc.)
  • Vec for JavaScript typed arrays (such as uint8array) etc.
  • Support for nested arrays. (example Vec<Vec>)
  • Support for &[T]

Some other notable changes:

  • Support for getting a javascript object as a parameter as well as returning an object.

@anonrig anonrig requested review from a team as code owners January 12, 2026 21:35
@anonrig anonrig force-pushed the yagiz/add-array-suport branch from 35b2d20 to a117878 Compare January 12, 2026 21:51
@codspeed-hq

This comment was marked as off-topic.

@anonrig anonrig requested review from guybedford and mikea January 12, 2026 22:34
Copy link
Contributor

@guybedford guybedford left a comment

Choose a reason for hiding this comment

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

Can Arrays of GC references be handled? There don't seem to be any test cases covering this. What happens for Vec<Ref> with this implementation currently?

Fine to defer, just nice to know what the situation is.

Comment on lines +35 to +40
//! | `Vec<u8>` | `Uint8Array` |
//! | `Vec<u16>` | `Uint16Array` |
//! | `Vec<u32>` | `Uint32Array` |
//! | `Vec<i8>` | `Int8Array` |
//! | `Vec<i16>` | `Int16Array` |
//! | `Vec<i32>` | `Int32Array` |
Copy link
Contributor

Choose a reason for hiding this comment

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

What about byte slice representations for Uint arrays? For example supporting [u8] for a Uint8Array.

Comment on lines +320 to +327
pub struct Array;
pub struct TypedArray;
pub struct Uint8Array;
pub struct Uint16Array;
pub struct Uint32Array;
pub struct Int8Array;
pub struct Int16Array;
pub struct Int32Array;
Copy link
Contributor

Choose a reason for hiding this comment

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

What about Float32Array and BigInt arrays?

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