Skip to content

Guides

Fresh 🌱

Conceptual guides for working with JavaScript values from Rust. Where the SOPs are procedures, these are explanations of how each piece of the bridge works.

Reading order

flowchart TD
    INTRO[Introduction] --> PRIM[Primitive Types]
    PRIM --> OBJ[Objects]
    OBJ --> ARR[Arrays]
    PRIM --> FN[Functions]
    FN --> CALL[Calling JavaScript]
    FN --> ERR[Error Handling]
    FN --> ASYNC[Async Tasks & Promises]
    OBJ --> BOX[Boxed Data: JsBox]
    OBJ --> TA[Buffers & Typed Arrays]
    style INTRO fill:#10b981,color:#fff
    style ASYNC fill:#6366f1,color:#fff
    style BOX fill:#f59e0b,color:#fff

All guides

GuideCovers
Introduction to NeonWhat Neon is, why you would use it, and the core mental model.
Primitive TypesNumbers, strings, booleans, null, undefined.
ObjectsCreating objects, getting/setting properties, converting Rust structs to JS.
ArraysCreating arrays, indexed access, converting to and from Vec.
FunctionsDefining, exporting, reading arguments, type-checking, optional args.
Calling JavaScript from Rustcall, construct, bind, and Root for persistent references.
Error HandlingThrowing exceptions, the ? operator, and the extract Error type.
Async Tasks, Promises & ChannelsWorker pool tasks, Channel, Promise, async exports with futures.
Boxed Native Data (JsBox)Embedding Rust structs inside JS objects with Finalize.
Buffers & Typed ArraysZero-copy access to binary data with JsTypedArray.

The cx is everything

Across all of these guides, the runtime context (cx) is the constant. It is your handle to the JavaScript engine: you create values with it, read arguments from it, and return results through it.