Skip to content
Kitbay
Skill

implementing-jsc-classes-rust

NOASSERTIONUpdated on Nov 11, 202696,758GitHub stars

A contributor guide in the Bun repository for adding a JavaScript class implemented in Rust, using Bun's bindings generator.

What the skill teaches

A contributor guide in the Bun repository for adding a JavaScript class implemented in Rust, using Bun's bindings generator. The class is described in a .bind.ts schema (constructor arguments, methods, getters, internal fields), and the generator produces the JavaScriptCore cell, prototype, constructor and argument conversion that call into a matching Rust struct, so any mismatch fails at compile time. It explains when the struct should be reference-counted, which capabilities a method can request to allocate, throw or run JavaScript, why JavaScript values must never be kept in struct fields, and which files in the repository serve as worked examples. It is only useful when changing Bun's own source.

Capabilities

Not stated in its documentation