Full Code of neon-bindings/neon for AI

main 252a5b698538 cached
280 files
1001.0 KB
274.2k tokens
1851 symbols
1 requests
Download .txt
Showing preview only (1,075K chars total). Download the full file or copy to clipboard to get everything.
Repository: neon-bindings/neon
Branch: main
Commit: 252a5b698538
Files: 280
Total size: 1001.0 KB

Directory structure:
gitextract_5xdlnvd5/

├── .cargo/
│   └── config.toml
├── .editorconfig
├── .github/
│   └── workflows/
│       ├── bench.yml
│       ├── ci.yml
│       └── lint.yml
├── .gitignore
├── .prettierignore
├── AUTHORS.md
├── CODE_OF_CONDUCT.md
├── CONTRIBUTING.md
├── Cargo.toml
├── LICENSE-APACHE
├── LICENSE-MIT
├── README.md
├── RELEASES.md
├── bench/
│   ├── .gitignore
│   ├── Cargo.toml
│   ├── README.md
│   ├── index.js
│   ├── package.json
│   └── src/
│       └── lib.rs
├── codecov.yml
├── crates/
│   ├── neon/
│   │   ├── Cargo.toml
│   │   └── src/
│   │       ├── context/
│   │       │   ├── internal.rs
│   │       │   └── mod.rs
│   │       ├── event/
│   │       │   ├── channel.rs
│   │       │   ├── mod.rs
│   │       │   └── task.rs
│   │       ├── executor/
│   │       │   ├── mod.rs
│   │       │   └── tokio.rs
│   │       ├── handle/
│   │       │   ├── internal.rs
│   │       │   ├── mod.rs
│   │       │   └── root.rs
│   │       ├── lib.rs
│   │       ├── lifecycle.rs
│   │       ├── macro_internal/
│   │       │   ├── futures.rs
│   │       │   └── mod.rs
│   │       ├── macros.rs
│   │       ├── meta.rs
│   │       ├── object/
│   │       │   ├── class.rs
│   │       │   ├── mod.rs
│   │       │   └── wrap.rs
│   │       ├── prelude.rs
│   │       ├── reflect.rs
│   │       ├── result/
│   │       │   └── mod.rs
│   │       ├── sys/
│   │       │   ├── array.rs
│   │       │   ├── arraybuffer.rs
│   │       │   ├── async_work.rs
│   │       │   ├── bindings/
│   │       │   │   ├── functions.rs
│   │       │   │   ├── mod.rs
│   │       │   │   └── types.rs
│   │       │   ├── buffer.rs
│   │       │   ├── call.rs
│   │       │   ├── convert.rs
│   │       │   ├── date.rs
│   │       │   ├── debug_send_wrapper.rs
│   │       │   ├── error.rs
│   │       │   ├── external.rs
│   │       │   ├── fun.rs
│   │       │   ├── lifecycle.rs
│   │       │   ├── mem.rs
│   │       │   ├── mod.rs
│   │       │   ├── no_panic.rs
│   │       │   ├── object.rs
│   │       │   ├── primitive.rs
│   │       │   ├── promise.rs
│   │       │   ├── raw.rs
│   │       │   ├── reference.rs
│   │       │   ├── scope.rs
│   │       │   ├── string.rs
│   │       │   ├── tag.rs
│   │       │   ├── tsfn.rs
│   │       │   └── typedarray.rs
│   │       ├── thread/
│   │       │   └── mod.rs
│   │       ├── types_docs.rs
│   │       └── types_impl/
│   │           ├── bigint.rs
│   │           ├── boxed.rs
│   │           ├── buffer/
│   │           │   ├── lock.rs
│   │           │   ├── mod.rs
│   │           │   └── types.rs
│   │           ├── date.rs
│   │           ├── error.rs
│   │           ├── extract/
│   │           │   ├── array.rs
│   │           │   ├── boxed.rs
│   │           │   ├── buffer.rs
│   │           │   ├── container.rs
│   │           │   ├── either.rs
│   │           │   ├── error.rs
│   │           │   ├── json.rs
│   │           │   ├── mod.rs
│   │           │   ├── private.rs
│   │           │   ├── try_from_js.rs
│   │           │   ├── try_into_js.rs
│   │           │   └── with.rs
│   │           ├── function/
│   │           │   ├── mod.rs
│   │           │   └── private.rs
│   │           ├── mod.rs
│   │           ├── private.rs
│   │           ├── promise.rs
│   │           └── utf8.rs
│   └── neon-macros/
│       ├── Cargo.toml
│       ├── LICENSE-APACHE
│       ├── LICENSE-MIT
│       └── src/
│           ├── class/
│           │   ├── meta.rs
│           │   └── mod.rs
│           ├── export/
│           │   ├── class/
│           │   │   └── meta.rs
│           │   ├── class.rs
│           │   ├── function/
│           │   │   ├── meta.rs
│           │   │   └── mod.rs
│           │   ├── global/
│           │   │   ├── meta.rs
│           │   │   └── mod.rs
│           │   └── mod.rs
│           ├── lib.rs
│           └── name.rs
├── doc/
│   ├── MIGRATION_GUIDE_0.10.md
│   ├── MIGRATION_GUIDE_1.0.0.md
│   └── MIGRATION_GUIDE_NAPI.md
├── package.json
├── pkgs/
│   ├── cargo-cp-artifact/
│   │   ├── LICENSE
│   │   ├── README.md
│   │   ├── bin/
│   │   │   └── cargo-cp-artifact.js
│   │   ├── package.json
│   │   ├── src/
│   │   │   ├── args.js
│   │   │   └── index.js
│   │   └── test/
│   │       └── args.js
│   └── create-neon/
│       ├── .mocharc.json
│       ├── README.md
│       ├── data/
│       │   ├── templates/
│       │   │   ├── .gitignore.hbs
│       │   │   ├── Cargo.toml.hbs
│       │   │   ├── README.md.hbs
│       │   │   ├── Workspace.toml.hbs
│       │   │   ├── ci/
│       │   │   │   └── github/
│       │   │   │       ├── build.yml.hbs
│       │   │   │       ├── release.yml.hbs
│       │   │   │       ├── setup.yml.hbs
│       │   │   │       └── test.yml.hbs
│       │   │   ├── lib.rs.hbs
│       │   │   ├── manifest/
│       │   │   │   └── base/
│       │   │   │       ├── default.json.hbs
│       │   │   │       └── library.json.hbs
│       │   │   ├── ts/
│       │   │   │   ├── index.cts.hbs
│       │   │   │   ├── index.mts.hbs
│       │   │   │   └── load.cts.hbs
│       │   │   └── tsconfig.json.hbs
│       │   └── versions.json
│       ├── dev/
│       │   └── expect.ts
│       ├── package.json
│       ├── src/
│       │   ├── bin/
│       │   │   └── create-neon.ts
│       │   ├── cache/
│       │   │   └── npm.ts
│       │   ├── cache.ts
│       │   ├── ci/
│       │   │   └── github.ts
│       │   ├── ci.ts
│       │   ├── create/
│       │   │   ├── app.ts
│       │   │   ├── creator.ts
│       │   │   └── lib.ts
│       │   ├── die.ts
│       │   ├── expand/
│       │   │   ├── context.ts
│       │   │   ├── index.ts
│       │   │   └── versions.ts
│       │   ├── fs.ts
│       │   ├── index.ts
│       │   ├── print.ts
│       │   └── shell.ts
│       ├── test/
│       │   └── create-neon.ts
│       └── tsconfig.json
└── test/
    ├── electron/
    │   ├── Cargo.toml
    │   ├── README.md
    │   ├── index.html
    │   ├── main.js
    │   ├── main.test.js
    │   ├── package.json
    │   ├── preload.js
    │   ├── renderer.js
    │   └── src/
    │       └── lib.rs
    ├── napi/
    │   ├── .gitignore
    │   ├── Cargo.toml
    │   ├── README.md
    │   ├── lib/
    │   │   ├── arrays.js
    │   │   ├── bigint.js
    │   │   ├── boxed.js
    │   │   ├── class.js
    │   │   ├── coercions.js
    │   │   ├── container.js
    │   │   ├── date.js
    │   │   ├── errors.js
    │   │   ├── export.js
    │   │   ├── extract.js
    │   │   ├── functions.js
    │   │   ├── futures.js
    │   │   ├── hello.js
    │   │   ├── numbers.js
    │   │   ├── objects.js
    │   │   ├── strings.js
    │   │   ├── threads.js
    │   │   ├── typedarrays.js
    │   │   ├── types.js
    │   │   └── workers.js
    │   ├── package.json
    │   └── src/
    │       ├── js/
    │       │   ├── arrays.rs
    │       │   ├── bigint.rs
    │       │   ├── boxed.rs
    │       │   ├── class.rs
    │       │   ├── coercions.rs
    │       │   ├── container.rs
    │       │   ├── date.rs
    │       │   ├── errors.rs
    │       │   ├── export.rs
    │       │   ├── extract.rs
    │       │   ├── functions.rs
    │       │   ├── futures.rs
    │       │   ├── numbers.rs
    │       │   ├── objects.rs
    │       │   ├── strings.rs
    │       │   ├── threads.rs
    │       │   ├── typedarrays.rs
    │       │   ├── types.rs
    │       │   └── workers.rs
    │       └── lib.rs
    ├── rust-2024/
    │   ├── .gitignore
    │   ├── Cargo.toml
    │   ├── README.md
    │   ├── package.json
    │   └── src/
    │       └── lib.rs
    └── ui/
        ├── Cargo.toml
        ├── src/
        │   └── lib.rs
        └── tests/
            ├── fail/
            │   ├── class-async-borrowed-channel.rs
            │   ├── class-async-borrowed-channel.stderr
            │   ├── class-async-context-ref.rs
            │   ├── class-async-context-ref.stderr
            │   ├── class-async-fn-borrowed-self.rs
            │   ├── class-async-fn-borrowed-self.stderr
            │   ├── class-async-owned-context.rs
            │   ├── class-async-owned-context.stderr
            │   ├── class-borrowed-channel-sync.rs
            │   ├── class-borrowed-channel-sync.stderr
            │   ├── class-channel-in-sync.rs
            │   ├── class-channel-in-sync.stderr
            │   ├── class-constructor-self-receiver.rs
            │   ├── class-constructor-self-receiver.stderr
            │   ├── class-constructor-with-self.rs
            │   ├── class-constructor-with-self.stderr
            │   ├── class-duplicate-property-names.rs
            │   ├── class-duplicate-property-names.stderr
            │   ├── class-immutable-context.rs
            │   ├── class-immutable-context.stderr
            │   ├── class-invalid-item-type.rs
            │   ├── class-invalid-item-type.stderr
            │   ├── class-invalid-property-name.rs
            │   ├── class-invalid-property-name.stderr
            │   ├── class-method-missing-self.rs
            │   ├── class-method-missing-self.stderr
            │   ├── class-missing-forced-context.rs
            │   ├── class-missing-forced-context.stderr
            │   ├── class-multiple-constructors.rs
            │   ├── class-multiple-constructors.stderr
            │   ├── class-multiple-finalizers.rs
            │   ├── class-multiple-finalizers.stderr
            │   ├── class-multiple-neon-attrs-const.rs
            │   ├── class-multiple-neon-attrs-const.stderr
            │   ├── class-multiple-neon-attrs-method.rs
            │   ├── class-multiple-neon-attrs-method.stderr
            │   ├── class-owned-context.rs
            │   ├── class-owned-context.stderr
            │   ├── missing-class-clone.rs
            │   ├── missing-class-clone.stderr
            │   ├── missing-class-default.rs
            │   ├── missing-class-default.stderr
            │   ├── missing-context.rs
            │   ├── missing-context.stderr
            │   ├── need-borrowed-context.rs
            │   ├── need-borrowed-context.stderr
            │   ├── unexpected-self.rs
            │   ├── unexpected-self.stderr
            │   ├── unnecessary-attribute.rs
            │   ├── unnecessary-attribute.stderr
            │   ├── unsupported-property.rs
            │   ├── unsupported-property.stderr
            │   ├── wrong-context.rs
            │   └── wrong-context.stderr
            └── pass/
                ├── context-and-this.rs
                ├── globals.rs
                └── json.rs

================================================
FILE CONTENTS
================================================

================================================
FILE: .cargo/config.toml
================================================
[alias]
# Neon defines mutually exclusive feature flags which prevents using `cargo clippy --all-features`
# The following aliases simplify linting the entire workspace
neon-check = " check  --all --all-targets --features napi-experimental,external-buffers,serde,tokio"
neon-clippy = "clippy --all --all-targets --features napi-experimental,external-buffers,serde,tokio -- -A clippy::missing_safety_doc"
neon-test = "  test   --all               --features=doc-dependencies,doc-comment,napi-experimental,external-buffers,serde,tokio"
neon-doc = "   rustdoc -p neon            --features=doc-dependencies,napi-experimental,external-buffers,sys,serde,tokio -- --cfg docsrs"


================================================
FILE: .editorconfig
================================================
root = true

[*]
indent_style = space
indent_size = 2
end_of_line = lf
charset = utf-8
trim_trailing_whitespace = true
insert_final_newline = true

[*.rs]
indent_size = 4

[*.toml]
indent_size = 4

[*.md]
trim_trailing_whitespace = false


================================================
FILE: .github/workflows/bench.yml
================================================
name: Benchmarks

on:
  push:
    branches:
      - main
  pull_request:
    branches:
      - main

jobs:
  bench:
    name: regression
    permissions:
      checks: write
      pull-requests: write
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v4
      - uses: bencherdev/bencher@main
      - name: Use Rust Stable
        uses: dtolnay/rust-toolchain@stable
      - name: Use Node.js
        uses: actions/setup-node@v4
        with:
          node-version: 20.x
          cache: npm
      - name: npm install
        run: npm ci --prefer-offline --no-audit --no-fund
      - name: Install Benchmark Dependencies
        working-directory: ./bench
        run: npm install
      - name: Build Benchmark
        working-directory: ./bench
        run: npm run build
      - name: Track base branch benchmarks with Bencher
        if: github.ref_name == 'main'
        run: bencher run
          --project neon
          --token '${{ secrets.BENCHER_API_TOKEN }}'
          --branch main
          --testbed ubuntu-latest
          --adapter json
          --github-actions '${{ secrets.GITHUB_TOKEN }}'
          npm run --silent benchmark
        working-directory: ./bench
      - name: Track pull request benchmarks with Bencher
        if: github.ref_name != 'main'
        run: bencher run
          --project neon
          --token '${{ secrets.BENCHER_API_TOKEN }}'
          --branch "$GITHUB_HEAD_REF"
          --start-point "$GITHUB_BASE_REF"
          --start-point-hash '${{ github.event.pull_request.base.sha }}'
          --start-point-clone-thresholds
          --start-point-reset
          --testbed ubuntu-latest
          --adapter json
          --github-actions '${{ secrets.GITHUB_TOKEN }}'
          npm run --silent benchmark
        working-directory: ./bench


================================================
FILE: .github/workflows/ci.yml
================================================
name: CI

on:
  push:
    # Prevent duplicate runs of this workflow on our own internal PRs.
    branches:
      - main
      - next/*
  pull_request:
    types: [opened, synchronize, reopened, labeled]
    branches:
      - main
      - next/*

env:
  PLAYWRIGHT_SKIP_BROWSER_DOWNLOAD: "true"

jobs:
  matrix:
    runs-on: ubuntu-latest
    outputs:
      node_version: ${{ steps.set_matrix.outputs.node_version }}
      rust_toolchain: ${{ steps.set_matrix.outputs.rust_toolchain }}
    steps:
      - name: Set Matrix
        id: set_matrix
        env:
          FULL_NODE_VERSIONS: '["18.x", "20.x"]'
          FULL_RUST_TOOLCHAINS: '["stable", "nightly"]'
          PARTIAL_NODE_VERSIONS: '["20.x"]'
          PARTIAL_RUST_TOOLCHAINS: '["stable"]'
          HAS_FULL_MATRIX_LABEL: ${{ contains(github.event.pull_request.labels.*.name, 'full matrix') }}
          IS_PUSHED: ${{ github.event_name == 'push' }}
        run: |
          if [[ "$HAS_FULL_MATRIX_LABEL" == "true" ]] || [[ "$IS_PUSHED" == "true" ]]; then
            echo "node_version=$FULL_NODE_VERSIONS" >> $GITHUB_OUTPUT
            echo "rust_toolchain=$FULL_RUST_TOOLCHAINS" >> $GITHUB_OUTPUT
          else
            echo "node_version=$PARTIAL_NODE_VERSIONS" >> $GITHUB_OUTPUT
            echo "rust_toolchain=$PARTIAL_RUST_TOOLCHAINS" >> $GITHUB_OUTPUT
          fi

  build:
    needs: matrix
    runs-on: ${{ matrix.os }}
    strategy:
      matrix:
        os: [ubuntu-latest, windows-latest, macos-latest]
        node-version: ${{fromJson(needs.matrix.outputs.node_version)}}
        rust-toolchain: ${{fromJson(needs.matrix.outputs.rust_toolchain)}}

    steps:
      - name: Checkout Code
        uses: actions/checkout@v4

      - name: Use Rust ${{ matrix.rust-toolchain }}
        uses: dtolnay/rust-toolchain@v1
        with:
          toolchain: ${{ matrix.rust-toolchain }}
          components: clippy,rustfmt

      - name: Rust Cache
        uses: Swatinem/rust-cache@v2

      - name: Use Node.js ${{ matrix.node-version }}
        uses: actions/setup-node@v4
        with:
          node-version: ${{ matrix.node-version }}
          cache: npm

      - name: Cache Electron (Linux)
        if: matrix.os == 'ubuntu-latest'
        uses: actions/cache@v4
        with:
          key: ${{ runner.os }}-electron-${{ hashFiles('./package-lock.json') }}
          path: ~/.cache/electron
      - name: Cache Electron (Windows)
        if: matrix.os == 'windows-latest'
        uses: actions/cache@v4
        with:
          key: ${{ runner.os }}-electron-${{ hashFiles('./package-lock.json') }}
          path: "%LOCALAPPDATA%\\electron\\Cache"
      - name: Cache Electron (macOS)
        if: matrix.os == 'macos-latest'
        uses: actions/cache@v4
        with:
          key: ${{ runner.os }}-electron-${{ hashFiles('./package-lock.json') }}
          path: ~/Library/Caches/electron

      - name: Install cargo-llvm-cov
        if: matrix.os == 'ubuntu-latest' && matrix.rust-toolchain == 'stable'
        uses: taiki-e/install-action@cargo-llvm-cov

      - name: Set coverage environment variables
        if: matrix.os == 'ubuntu-latest' && matrix.rust-toolchain == 'stable'
        run: cargo llvm-cov show-env | tr -d "'" >> $GITHUB_ENV

      - name: npm install
        run: npm ci --prefer-offline --no-audit --no-fund

      - name: Allow unprivileged X server
        if: matrix.os == 'ubuntu-latest'
        run: sudo sysctl -w kernel.apparmor_restrict_unprivileged_userns=0

      - name: Test (Linux)
        if: matrix.os == 'ubuntu-latest'
        run: xvfb-run --auto-servernum npm test -- --nocapture
      - name: Test
        if: matrix.os != 'ubuntu-latest'
        run: npm test

      - name: Generate coverage report
        if: matrix.os == 'ubuntu-latest' && matrix.rust-toolchain == 'stable'
        run: cargo llvm-cov report --codecov --output-path target/codecov.json

      - name: Upload coverage to Codecov
        if: matrix.os == 'ubuntu-latest' && matrix.rust-toolchain == 'stable'
        uses: codecov/codecov-action@v5
        with:
          token: ${{ secrets.CODECOV_TOKEN }}
          slug: neon-bindings/neon
          files: target/codecov.json


================================================
FILE: .github/workflows/lint.yml
================================================
name: Lints

on:
  push:
    # Prevent duplicate runs of this workflow on our own internal PRs.
    branches:
      - main
      - next/*
  pull_request:
    branches:
      - main
      - next/*

env:
  PLAYWRIGHT_SKIP_BROWSER_DOWNLOAD: "true"

jobs:
  lint:
    runs-on: ubuntu-latest

    strategy:
      matrix:
        node-version: [20.x]
        rust-toolchain: [nightly]

    steps:
      - name: Checkout Code
        uses: actions/checkout@v4
      - name: Use Rust ${{ matrix.rust-toolchain }}
        uses: dtolnay/rust-toolchain@v1
        with:
          toolchain: ${{ matrix.rust-toolchain }}
          components: clippy,rustfmt
      - name: Rust Cache
        uses: Swatinem/rust-cache@v2
      - name: Use Node.js ${{ matrix.node-version }}
        uses: actions/setup-node@v4
        with:
          node-version: ${{ matrix.node-version }}
          cache: "npm"
      - name: Cache Electron
        uses: actions/cache@v4
        with:
          path: ~/.cache/electron
          key: ${{ runner.os }}-electron-${{ hashFiles('./package-lock.json') }}
      - name: npm install
        run: npm ci --prefer-offline --no-audit --no-fund
      - name: Prettier Formatting
        run: npm run prettier:check
      - name: Rust Formatting
        run: cargo fmt --all -- --check
      - name: Rust Clippy
        run: cargo neon-clippy


================================================
FILE: .gitignore
================================================
# Rust
target
rls*.log

# Created by `trybuild` ui tests
wip
**/*~

# Node
**/node_modules
npm-debug.log

# JS build
**/build
**/dist
cli/lib
test/cli/lib

# Neon build
**/index.node
**/artifacts.json
pkgs/create-neon/create-neon-test-project
pkgs/create-neon/create-neon-manual-test-project

# System
**/.DS_Store


================================================
FILE: .prettierignore
================================================
.git/
cli/lib/
test/cli/lib/
node_modules/
**/dist/
target/
artifacts.json


================================================
FILE: AUTHORS.md
================================================
# Authors

Neon owes its existence to the contributions of these fine people.

* [Reza Akhavan](https://github.com/jedireza)
* [andiliu-gh](https://github.com/andiliu-gh)
* [Nerijus Arlauskas](https://github.com/Nercury)
* [Igor Artamonov](https://github.com/splix)
* [Peter Atashian](https://github.com/retep998)
* [Alexander Azarov](https://github.com/alaz)
* [David Baker](https://github.com/dbkr)
* [Sean Billig](https://github.com/sbillig)
* [Tim Blair](https://github.com/tblair)
* [Max Brunsfeld](https://github.com/maxbrunsfeld)
* [Dale Bustad](https://github.com/divmain)
* [Eduard-Mihai Burtescu](https://github.com/eddyb)
* [Gabriel Castro](https://github.com/GabrielCastro)
* [Lin Clark](https://github.com/linclark)
* [ComplexSpaces](https://github.com/complexspaces)
* [Nathaniel Daniel](https://github.com/adumbidiot)
* [John Darrington](https://github.com/DnOberon)
* [erics118](https://github.com/erics118)
* [Joey Ezechiëls](https://github.com/jjpe)
* [Ryan Fitzgerald](https://github.com/rf-)
* [Cory Forsyth](https://github.com/bantic)
* [Olivier Goffart](https://github.com/ogoffart)
* [Dave Herman](https://github.com/dherman)
* [Himself65](https://github.com/Himself65)
* [Maciej Hirsz](https://github.com/maciejhirsz)
* [Amal Hussein](https://github.com/nomadtechie)
* [Fedor Indutny](https://github.com/indutny)
* [Usagi Ito](https://github.com/usagi)
* [j1ngzoue](https://github.com/activeguild)
* [Jeroen (jrd-rocks)](https://github.com/jrd-rocks)
* [Keegan (mhsjlw)](https://github.com/mhsjlw)
* [Florian Keller](https://github.com/ffflorian)
* [Aleksey Kladov](https://github.com/matklad)
* [Adam Kloboucnik](https://github.com/akloboucnik)
* [Renée Kooi](https://github.com/goto-bus-stop)
* [Laz](https://github.com/lazops)
* [Anton Lazarev](https://github.com/antonok-edm)
* [Simon Liang](https://github.com/lhr0909)
* [Matthew Little](https://github.com/zone117x)
* [Terence Lee](https://github.com/hone)
* [Milan Loveless](https://github.com/MilanLoveless)
* [Mikuroさいな](https://github.com/MikuroXina)
* [MikaelUrankar](https://github.com/MikaelUrankar)
* [Darin Morrison](https://github.com/freebroccolo)
* [Martin Muñoz](https://github.com/mmun)
* [Dominik Nakamura](https://github.com/dnaka91)
* [Kayo Phoenix](https://github.com/katyo)
* [Mike Piccolo](https://github.com/mfpiccolo)
* [Jan Piotrowski](https://github.com/janpio)
* [Robbie Pitts](https://github.com/robbiepitts)
* [Thiago Pontes](https://github.com/thiagopnts)
* [Sean Prashad](https://github.com/SeanPrashad)
* [Jordan Rose](https://github.com/jrose-signal)
* [Antonio Scandurra](https://github.com/as-cii)
* [Edward Shaw](https://github.com/EdShaw)
* [Nathan Sobo](https://github.com/nathansobo)
* [sockmaster27](https://github.com/sockmaster27)
* [André Staltz](https://github.com/staltz)
* [Ingvar Stepanyan](https://github.com/RReverser)
* [stoically](https://github.com/stoically)
* [Andrew Stucki](https://github.com/andrewstucki)
* [Martin Svanberg](https://github.com/msvbg)
* [A2ZH (theJian)](https://github.com/theJian)
* [Alex Touchet](https://github.com/atouchet)
* [Corbin Uselton](https://github.com/corbinu)
* [K.J. Valencik](https://github.com/kjvalencik)
* [Velithris](https://github.com/Zireael-N)
* [Roberto Vidal](https://github.com/jrvidal)
* [Georg Vienna](https://github.com/geovie)
* [Daijiro Wachi](https://github.com/watilde)
* [Chi Wang](https://github.com/patr0nus)
* [wangcong](https://github.com/king6cong)
* [Amila Welihinda](https://github.com/amilajack)
* [xyloflake](https://github.com/xyloflake)
* [Felix Yan](https://github.com/felixonmars)


================================================
FILE: CODE_OF_CONDUCT.md
================================================
# Contributor Covenant Code of Conduct

## Our Pledge

In the interest of fostering an open and welcoming environment, we as
contributors and maintainers pledge to making participation in our project and
our community a harassment-free experience for everyone, regardless of age, body
size, disability, ethnicity, gender identity and expression, level of experience,
nationality, personal appearance, race, religion, or sexual identity and
orientation.

## Our Standards

Examples of behavior that contributes to creating a positive environment
include:

* Using welcoming and inclusive language
* Being respectful of differing viewpoints and experiences
* Gracefully accepting constructive criticism
* Focusing on what is best for the community
* Showing empathy towards other community members

Examples of unacceptable behavior by participants include:

* The use of sexualized language or imagery and unwelcome sexual attention or
  advances
* Trolling, insulting/derogatory comments, and personal or political attacks
* Public or private harassment
* Publishing others' private information, such as a physical or electronic
  address, without explicit permission
* Other conduct which could reasonably be considered inappropriate in a
  professional setting

## Our Responsibilities

Project maintainers are responsible for clarifying the standards of acceptable
behavior and are expected to take appropriate and fair corrective action in
response to any instances of unacceptable behavior.

Project maintainers have the right and responsibility to remove, edit, or
reject comments, commits, code, wiki edits, issues, and other contributions
that are not aligned to this Code of Conduct, or to ban temporarily or
permanently any contributor for other behaviors that they deem inappropriate,
threatening, offensive, or harmful.

## Scope

This Code of Conduct applies both within project spaces and in public spaces
when an individual is representing the project or its community. Examples of
representing a project or community include using an official project e-mail
address, posting via an official social media account, or acting as an appointed
representative at an online or offline event. Representation of a project may be
further defined and clarified by project maintainers.

## Enforcement

Instances of abusive, harassing, or otherwise unacceptable behavior may be
reported by contacting the project team at david.herman@gmail.com. All
complaints will be reviewed and investigated and will result in a response that
is deemed necessary and appropriate to the circumstances. The project team is
obligated to maintain confidentiality with regard to the reporter of an incident.
Further details of specific enforcement policies may be posted separately.

Project maintainers who do not follow or enforce the Code of Conduct in good
faith may face temporary or permanent repercussions as determined by other
members of the project's leadership.

## Attribution

This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4,
available at https://www.contributor-covenant.org/version/1/4/code-of-conduct.html

[homepage]: https://www.contributor-covenant.org



================================================
FILE: CONTRIBUTING.md
================================================
# Contributing to Neon

Neon welcomes contribution from everyone. Here are some resources to help you join us!

## Contributions

### Issue reports

We welcome issues and aim to keep the barrier low. Just [file a GitHub issue](https://github.com/neon-bindings/neon/issues)
like normal---we don't require issue templates or have any particular process.

That said, the more information you can provide to help us reproduce your issue, the better!

### Requests For Comments

If you would like to propose a design change or new feature for the Neon API or the `neon` command-line tool,
we encourage you to [submit an RFC](https://github.com/neon-bindings/rfcs)!

The [RFC process](https://github.com/neon-bindings/rfcs#the-process) has a little more overhead than
filing an issue, but it's for the goal of allowing the Neon community to have a chance to vet
design ideas and reach consensus. And even at that, we've deliberately kept the [RFC template](https://github.com/neon-bindings/rfcs/blob/main/0000-template.md)
simple and open-ended.

### Good first bugs

Search our issue tracker for anything labeled **[beginner friendly](https://github.com/neon-bindings/neon/issues?q=is%3Aissue+is%3Aopen+label%3A%22beginner+friendly%22)**.

**We are here to help you!** Join our Slack and send an at-mention to **@dherman** and we'll happily arrange
to help you get going and mentor you as much as you feel would be helpful.

## Conduct

We follow the [Contributor Covenant Code of Conduct](https://www.contributor-covenant.org/version/1/4/code-of-conduct.html).
The maintainers of Neon personally promise to work actively to uphold that code of conduct.
We aim to foster a community that is welcoming, inclusive, empathetic, and kind.
If you share those goals and want to have a ton of fun playing with Rust and JS, we hope you will come be a part of our community!

## License

Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in the work by you, as defined in the Apache-2.0 license, shall be dual licensed as described in the [README](README.md), without any additional terms or conditions.

## Communication

* Slack: <https://rust-bindings.slack.com> -- get an invite from [the Slackin app](https://rust-bindings-slackin.herokuapp.com)


================================================
FILE: Cargo.toml
================================================
[workspace]
resolver = "2"
members = [
    "crates/*",
    "test/*",
    "bench",
]

[profile.release]
lto = true


================================================
FILE: LICENSE-APACHE
================================================
                              Apache License
                        Version 2.0, January 2004
                     http://www.apache.org/licenses/

TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION

1. Definitions.

   "License" shall mean the terms and conditions for use, reproduction,
   and distribution as defined by Sections 1 through 9 of this document.

   "Licensor" shall mean the copyright owner or entity authorized by
   the copyright owner that is granting the License.

   "Legal Entity" shall mean the union of the acting entity and all
   other entities that control, are controlled by, or are under common
   control with that entity. For the purposes of this definition,
   "control" means (i) the power, direct or indirect, to cause the
   direction or management of such entity, whether by contract or
   otherwise, or (ii) ownership of fifty percent (50%) or more of the
   outstanding shares, or (iii) beneficial ownership of such entity.

   "You" (or "Your") shall mean an individual or Legal Entity
   exercising permissions granted by this License.

   "Source" form shall mean the preferred form for making modifications,
   including but not limited to software source code, documentation
   source, and configuration files.

   "Object" form shall mean any form resulting from mechanical
   transformation or translation of a Source form, including but
   not limited to compiled object code, generated documentation,
   and conversions to other media types.

   "Work" shall mean the work of authorship, whether in Source or
   Object form, made available under the License, as indicated by a
   copyright notice that is included in or attached to the work
   (an example is provided in the Appendix below).

   "Derivative Works" shall mean any work, whether in Source or Object
   form, that is based on (or derived from) the Work and for which the
   editorial revisions, annotations, elaborations, or other modifications
   represent, as a whole, an original work of authorship. For the purposes
   of this License, Derivative Works shall not include works that remain
   separable from, or merely link (or bind by name) to the interfaces of,
   the Work and Derivative Works thereof.

   "Contribution" shall mean any work of authorship, including
   the original version of the Work and any modifications or additions
   to that Work or Derivative Works thereof, that is intentionally
   submitted to Licensor for inclusion in the Work by the copyright owner
   or by an individual or Legal Entity authorized to submit on behalf of
   the copyright owner. For the purposes of this definition, "submitted"
   means any form of electronic, verbal, or written communication sent
   to the Licensor or its representatives, including but not limited to
   communication on electronic mailing lists, source code control systems,
   and issue tracking systems that are managed by, or on behalf of, the
   Licensor for the purpose of discussing and improving the Work, but
   excluding communication that is conspicuously marked or otherwise
   designated in writing by the copyright owner as "Not a Contribution."

   "Contributor" shall mean Licensor and any individual or Legal Entity
   on behalf of whom a Contribution has been received by Licensor and
   subsequently incorporated within the Work.

2. Grant of Copyright License. Subject to the terms and conditions of
   this License, each Contributor hereby grants to You a perpetual,
   worldwide, non-exclusive, no-charge, royalty-free, irrevocable
   copyright license to reproduce, prepare Derivative Works of,
   publicly display, publicly perform, sublicense, and distribute the
   Work and such Derivative Works in Source or Object form.

3. Grant of Patent License. Subject to the terms and conditions of
   this License, each Contributor hereby grants to You a perpetual,
   worldwide, non-exclusive, no-charge, royalty-free, irrevocable
   (except as stated in this section) patent license to make, have made,
   use, offer to sell, sell, import, and otherwise transfer the Work,
   where such license applies only to those patent claims licensable
   by such Contributor that are necessarily infringed by their
   Contribution(s) alone or by combination of their Contribution(s)
   with the Work to which such Contribution(s) was submitted. If You
   institute patent litigation against any entity (including a
   cross-claim or counterclaim in a lawsuit) alleging that the Work
   or a Contribution incorporated within the Work constitutes direct
   or contributory patent infringement, then any patent licenses
   granted to You under this License for that Work shall terminate
   as of the date such litigation is filed.

4. Redistribution. You may reproduce and distribute copies of the
   Work or Derivative Works thereof in any medium, with or without
   modifications, and in Source or Object form, provided that You
   meet the following conditions:

   (a) You must give any other recipients of the Work or
       Derivative Works a copy of this License; and

   (b) You must cause any modified files to carry prominent notices
       stating that You changed the files; and

   (c) You must retain, in the Source form of any Derivative Works
       that You distribute, all copyright, patent, trademark, and
       attribution notices from the Source form of the Work,
       excluding those notices that do not pertain to any part of
       the Derivative Works; and

   (d) If the Work includes a "NOTICE" text file as part of its
       distribution, then any Derivative Works that You distribute must
       include a readable copy of the attribution notices contained
       within such NOTICE file, excluding those notices that do not
       pertain to any part of the Derivative Works, in at least one
       of the following places: within a NOTICE text file distributed
       as part of the Derivative Works; within the Source form or
       documentation, if provided along with the Derivative Works; or,
       within a display generated by the Derivative Works, if and
       wherever such third-party notices normally appear. The contents
       of the NOTICE file are for informational purposes only and
       do not modify the License. You may add Your own attribution
       notices within Derivative Works that You distribute, alongside
       or as an addendum to the NOTICE text from the Work, provided
       that such additional attribution notices cannot be construed
       as modifying the License.

   You may add Your own copyright statement to Your modifications and
   may provide additional or different license terms and conditions
   for use, reproduction, or distribution of Your modifications, or
   for any such Derivative Works as a whole, provided Your use,
   reproduction, and distribution of the Work otherwise complies with
   the conditions stated in this License.

5. Submission of Contributions. Unless You explicitly state otherwise,
   any Contribution intentionally submitted for inclusion in the Work
   by You to the Licensor shall be under the terms and conditions of
   this License, without any additional terms or conditions.
   Notwithstanding the above, nothing herein shall supersede or modify
   the terms of any separate license agreement you may have executed
   with Licensor regarding such Contributions.

6. Trademarks. This License does not grant permission to use the trade
   names, trademarks, service marks, or product names of the Licensor,
   except as required for reasonable and customary use in describing the
   origin of the Work and reproducing the content of the NOTICE file.

7. Disclaimer of Warranty. Unless required by applicable law or
   agreed to in writing, Licensor provides the Work (and each
   Contributor provides its Contributions) on an "AS IS" BASIS,
   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
   implied, including, without limitation, any warranties or conditions
   of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
   PARTICULAR PURPOSE. You are solely responsible for determining the
   appropriateness of using or redistributing the Work and assume any
   risks associated with Your exercise of permissions under this License.

8. Limitation of Liability. In no event and under no legal theory,
   whether in tort (including negligence), contract, or otherwise,
   unless required by applicable law (such as deliberate and grossly
   negligent acts) or agreed to in writing, shall any Contributor be
   liable to You for damages, including any direct, indirect, special,
   incidental, or consequential damages of any character arising as a
   result of this License or out of the use or inability to use the
   Work (including but not limited to damages for loss of goodwill,
   work stoppage, computer failure or malfunction, or any and all
   other commercial damages or losses), even if such Contributor
   has been advised of the possibility of such damages.

9. Accepting Warranty or Additional Liability. While redistributing
   the Work or Derivative Works thereof, You may choose to offer,
   and charge a fee for, acceptance of support, warranty, indemnity,
   or other liability obligations and/or rights consistent with this
   License. However, in accepting such obligations, You may act only
   on Your own behalf and on Your sole responsibility, not on behalf
   of any other Contributor, and only if You agree to indemnify,
   defend, and hold each Contributor harmless for any liability
   incurred by, or claims asserted against, such Contributor by reason
   of your accepting any such warranty or additional liability.

END OF TERMS AND CONDITIONS

APPENDIX: How to apply the Apache License to your work.

   To apply the Apache License to your work, attach the following
   boilerplate notice, with the fields enclosed by brackets "[]"
   replaced with your own identifying information. (Don't include
   the brackets!)  The text should be enclosed in the appropriate
   comment syntax for the file format. We also recommend that a
   file or class name and description of purpose be included on the
   same "printed page" as the copyright notice for easier
   identification within third-party archives.

Copyright [yyyy] [name of copyright owner]

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

	http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.


================================================
FILE: LICENSE-MIT
================================================
Copyright (c) 2015 David Herman

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.


================================================
FILE: README.md
================================================
# <img src="https://raw.githubusercontent.com/neon-bindings/neon/refs/heads/main/doc/neon.png" alt="neon" width="100%" />

[![Cargo](https://img.shields.io/crates/v/neon.svg)](https://crates.io/crates/neon)
[![Test Status](https://github.com/neon-bindings/neon/workflows/CI/badge.svg)](https://github.com/neon-bindings/neon/actions?query=workflow%3A%22CI%22)
[![Lint Status](https://github.com/neon-bindings/neon/workflows/Lints/badge.svg)](https://github.com/neon-bindings/neon/actions?query=workflow%3A%22Lints%22)

Rust bindings for writing safe and fast Node.js native addons.

## Getting started

Once you have the [platform dependencies](https://neon-bindings.com/docs/quick-start) installed, getting started is as
simple as:

```
$ npm init neon@latest my-project
```

Then see the [Hello World guide](https://neon-bindings.com/docs/hello-world/) for writing your first Hello World in
Neon!

## Docs

See our [Neon fundamentals docs](https://neon-bindings.com/docs/intro) and
our [API docs](https://docs.rs/neon/latest/neon).

## Neon 1.0.0 Migration Guide

The latest version of Neon, 1.0.0, includes several breaking changes in order to fix unsoundness, improve consistency, and add features.

**Read the new [migration guide](doc/MIGRATION_GUIDE_1.0.0.md)** to learn how to port your 
Neon projects to 1.0.0!

## Platform Support

### Operating Systems

| Linux  | macOS | Windows |
| ------ | ----- | ------- |
| ✓      | ✓     | ✓       |

### Node.js

Neon actively supports all current and [maintenance releases of Node](https://github.com/nodejs/LTS#release-schedule). If you're
using a different version of Node and believe it should be supported, let us know.

Older Node version support (minimum v10) may require lower Node-API versions. See the Node [version support matrix](https://nodejs.org/api/n-api.html#node-api-version-matrix) for more details.

### Bun (experimental)

[Bun](https://bun.sh/) is an alternate JavaScript runtime that targets Node compatibility. In many cases Neon modules will work in bun; however, at the time of this writing, some Node-API functions are [not implemented](https://github.com/oven-sh/bun/issues/158).

### Rust

Neon supports Rust stable version 1.65 and higher. We test on the latest stable, beta, and nightly versions of Rust.

## A Taste...

```rust
fn make_an_array(mut cx: FunctionContext) -> JsResult<JsArray> {
    // Create some values:
    let n = cx.number(9000);
    let s = cx.string("hello");
    let b = cx.boolean(true);

    // Create a new array:
    let array = cx.empty_array();

    // Push the values into the array:
    array.set(&mut cx, 0, n)?;
    array.set(&mut cx, 1, s)?;
    array.set(&mut cx, 2, b)?;

    // Return the array:
    Ok(array)
}

#[neon::main]
fn main(mut cx: ModuleContext) -> NeonResult<()> {
    cx.export_function("make_an_array", make_an_array)?;
    Ok(())
}
```

For more examples, see our [examples repo](https://github.com/neon-bindings/examples) and [integration tests](test).

## Get Involved

The Neon community is just getting started and there's tons of fun to be had. Come play! :)

The [Neon Community Slack](https://rust-bindings.slack.com) is open to all;
use [this invite link](https://join.slack.com/t/rust-bindings/shared_invite/zt-1pl5s83xe-ZvXyrzL8vuUmijU~7yiEcg) to receive an invitation.

### Testing Neon

The Neon project is both an [NPM workspace](https://docs.npmjs.com/cli/v8/using-npm/workspaces) and
a [Cargo workspace](https://doc.rust-lang.org/cargo/reference/workspaces.html). The full suite of tests may be executed
by installing and testing the NPM workspace.

```sh
npm install
npm test
```

Individual JavaScript packages may be tested with an `npm` workspace command:

```
npm --workspace=create-neon test
```

Individual Rust crates may be tested with a `cargo` workspace command:

```
cargo test -p neon-build
```

## License

Licensed under either of

* Apache License, Version 2.0 ([LICENSE-APACHE](LICENSE-APACHE) or http://www.apache.org/licenses/LICENSE-2.0)
* MIT license ([LICENSE-MIT](LICENSE-MIT) or http://opensource.org/licenses/MIT)

at your option.


================================================
FILE: RELEASES.md
================================================
# `cargo-cp-artifact`

`0.1.9` supports a [breaking change in `cargo`](https://github.com/rust-lang/cargo/issues/13867) that converts artifact names from `kebab-case` to `snake_case`.

# Version 1.2.0-alpha.0

### New Features

* [Class macro](https://docs.rs/neon/1/neon/attr.class)
* [impl TryFromJs for i32 and u32](https://github.com/neon-bindings/neon/pull/1107)
* [impl TryIntoJs for LazyLock](https://github.com/neon-bindings/neon/pull/1111)
* [`Deferred::settle()` and `Deferred::try_settle()`](https://github.com/neon-bindings/neon/pull/1120)

# Version 1.1.0

## Continued Commitment to Compatibility

Our strong commitment to compatibility since the 1.0 release remains unchanged. New functionality
that has not yet stabilized is published under feature flags, so the only breaking changes that we
expect to publish are those that affect the unstable features, or, as always, safety bugfixes.

## Version 1.1.1

Hotfix for Node-API versions lower than 5 (https://github.com/neon-bindings/neon/pull/1106).

## Version 1.1.0

### New Features

* [Extractors API](https://docs.rs/neon/1/neon/types/extract/index.html)
* [`#[export]` macro](https://docs.rs/neon/1/neon/attr.export.html)
* [`npm init neon -- --lib`](https://www.npmjs.com/package/create-neon)
* [`JsBox::deref()`](https://docs.rs/neon/1/neon/types/struct.JsBox.html#method.deref)
* [`Handle<'_, JsBox>::as_inner()`](https://docs.rs/neon/1/neon/handle/struct.Handle.html#method.as_inner)

### Bugfixes

* Fix panic when borrowing empty buffer or typed array (https://github.com/neon-bindings/neon/pull/1058)
* Fix build script behavior based on cargo diagnostics format change (https://github.com/neon-bindings/neon/pull/1039)

## Version 1.1.0-alpha.2

### Breaking Changes (unstable features only)

* Convert snake_case to camelCase when exporting functions (https://github.com/neon-bindings/neon/pull/1084)
* Remove `FromArgs` impl on `T: TryFromJs` and add `cx.{arg, arg_opt}` (https://github.com/neon-bindings/neon/pull/1096)

### Other

* Relax lifetime constraints on `With` (https://github.com/neon-bindings/neon/pull/1086)
* Add `JsBox::{deref, as_inner}` to get long-lived reference to JsBox contents (https://github.com/neon-bindings/neon/pull/1087)
* Add extractors for TypedArrays (https://github.com/neon-bindings/neon/pull/1089)
* Add extractors for common container types (https://github.com/neon-bindings/neon/pull/1091)

## Version 1.1.0-alpha.1

### Breaking Changes (unstable features only)

* `TryIntoJs` and `TryFromJs` take `Cx` instead of generic `Context` (https://github.com/neon-bindings/neon/pull/1062)

### Bugfixes

* Fix panic when borrowing empty buffer or typed array (https://github.com/neon-bindings/neon/pull/1058)

### Other

* More reliable checking for `Result` types in `#[export]` (https://github.com/neon-bindings/neon/pull/1057)
* Allow users to take `Cx` instead of generic `Context` (https://github.com/neon-bindings/neon/pull/1048)
* Introduce `With` for `TryIntoJs` (https://github.com/neon-bindings/neon/pull/1059)
* Add tokio async runtime support to `#[export]` (https://github.com/neon-bindings/neon/pull/1055)
* Add `TryIntoJs` and `TryFromJs` for common container types (https://github.com/neon-bindings/neon/pull/1066)
* Allow `Cx` in exported functions (https://github.com/neon-bindings/neon/pull/1068)

## Version 1.1.0-alpha.0

### Bugfixes

* Fix build script behavior based on cargo diagnostics format change (https://github.com/neon-bindings/neon/pull/1039)

### Other

* Added Extractors API (https://github.com/neon-bindings/neon/pull/1024)
* Added `#[export]` macro (https://github.com/neon-bindings/neon/pull/1025)
* Added `npm init neon --lib` (https://github.com/neon-bindings/neon/pull/1014 and https://github.com/neon-bindings/neon/pull/1041)


# Version 1.0.0

## Commitment to Compatibility

The release of Neon 1.0 marks our commitment to backwards-compatibility: starting with 1.0.0, Neon users can be confident that future **upgrades to Neon 1.x versions should never require code changes** (with the possible exception of safety bugfixes, which we expect to be rare). We also do not anticipate releasing new major versions often and do not have any plans to do so for now.

## Breaking Changes

* Remove the generic parameter from `JsFunction` (https://github.com/neon-bindings/neon/pull/989)
* `JsArray::new` takes a `usize` instead of a `u32` (https://github.com/neon-bindings/neon/pull/988)
* Made `Context::global` read a key and added `Context::global_object` (https://github.com/neon-bindings/neon/pull/987)
* Deprecated feature flags were removed

## Bug fixes

* Fix `unhandledRejection` with `JsPromise::to_future` (https://github.com/neon-bindings/neon/pull/1008)
* Typo in `cargo-cp-artifact` help (https://github.com/neon-bindings/neon/pull/998)
* Typo in README (https://github.com/neon-bindings/neon/pull/1012)

## Other

https://github.com/neon-bindings/neon/pull/1010

* Relaxed error behavior on missing Node-API symbols. Neon will panic on first use instead of aborting the process at module load time.
* Bumped dependency versions
* Changed to edition 2021
* Updated support matrix to Node 18, 20, and 21

# Version 1.0.0-alpha.4

Patch to enable new features flags in docs.rs.

# Version 1.0.0-alpha.3

## Breaking Changes

* Removed `Managed` trait

## Improvements

* Added `JsBigInt` (https://github.com/neon-bindings/neon/pull/963).
* Added UTF-16 functions to `JsString` (https://github.com/neon-bindings/neon/pull/944).
* Relaxed `Send` constraints (https://github.com/neon-bindings/neon/pull/979)
* Lifecycle support for 32-bit (https://github.com/neon-bindings/neon/pull/977)
* Added `sys` feature (https://github.com/neon-bindings/neon/pull/970)

## Bug Fixes

* Fix a scope leak in release builds (https://github.com/neon-bindings/neon/pull/952).

## Docs

* Examples added for many types ((https://github.com/neon-bindings/neon/pull/942)).

### `cargo-cp-artifact`

`0.1.8` fixes sending additional arguments on Windows (https://github.com/neon-bindings/neon/pull/972).

# Version 1.0.0-alpha.2

## Breaking Changes

### `neon::object::This`

https://github.com/neon-bindings/neon/pull/918

Trait [`neon::object::This`](https://docs.rs/neon/latest/neon/object/trait.This.html) has been removed. `This` was primarily added for use with the `declare_types!` macro to generate classes. The macro was removed and `This` is no longer needed. Additionally, the `This` argument on `JsFunction` was found to be _invalid_ because it asserted at compile time a type for `this` that could change at runtime. (Note that this was _not_ unsound because the type would be checked by Node-API and result in a `panic`.)

### `JsFunction::this`

https://github.com/neon-bindings/neon/pull/918

`JsFunction::this` was changed to perform a downcast and be _fallible_. This is in line with similar APIs (e.g., `Object::get`). Additionally, an infallible version, `JsValue::this_value` was added that does _not_ perform a downcast.

### Added Feature flag for external buffers

https://github.com/neon-bindings/neon/pull/937

Electron began using [pointer compression](https://www.electronjs.org/blog/v8-memory-cage) on JavaScript values that is incompatible with external buffers. As a preventative measure, `JsArrayBuffer::external` and `JsBuffer::external` have been placed behind a feature flag that warns of Electron incompatibility.

## Improvements

* Lifetimes were relaxed on `execute_scoped` to allow valid code to compile. (https://github.com/neon-bindings/neon/pull/919)
* Added a `from_slice` helper on `TypedArray` (https://github.com/neon-bindings/neon/pull/925)
* `JsTypedArray` construction and type aliases (https://github.com/neon-bindings/neon/pull/909)

## Bug Fixes

* Fixed a panic on VM shutdown when using `Channel` (https://github.com/neon-bindings/neon/pull/934)
* Type tags were added to `JsBox` to prevent undefined behavior when multiple native add-ons are used (https://github.com/neon-bindings/neon/pull/907)

## Docs

* Significantly improved documentation of `TypedArray` (https://github.com/neon-bindings/neon/pull/909)
* Removed unused values in `Channel` docs (https://github.com/neon-bindings/neon/pull/925)

### `cargo-cp-artifact`

`0.1.7` includes a fix to unlink `.node` files before copying to address common code signing errors on macOS (https://github.com/neon-bindings/neon/pull/921).

# Version 1.0.0-alpha.1

Pre-release of a major milestone for Neon. 1.0.

## Breaking Changes

### Major

* Removed the legacy backend; only Node-API is supported going forward (https://github.com/neon-bindings/neon/pull/881)
* Removed `neon::result::JsResultExt` in favor of more general `neon::result::ResultExt` (https://github.com/neon-bindings/neon/pull/904)

### Minor

* Length APIs (`argument`, `argument_ops`, `len`) use `usize` instead of `i32` (https://github.com/neon-bindings/neon/pull/889)
* Deprecate feature flags for accepted RFCs (https://github.com/neon-bindings/neon/pull/872)
* `neon::meta::version` returns `semver@1` version instead of `0.9` (https://github.com/neon-bindings/neon/pull/912)

## Features

* Add `Object.freeze` and `Object.seal` (https://github.com/neon-bindings/neon/pull/891)
* Futures RFC (https://github.com/neon-bindings/neon/pull/872) Implementation (https://github.com/neon-bindings/neon/pull/874)
  - Await `JoinHandle` from sending an event on a `Channel`
  - Adapt `JsPromise` to `JsFuture`
* API for thread-local data (i.e., instance data) (https://github.com/neon-bindings/neon/pull/902)
* Add Object::call_with() convenience method to call a method on an object (https://github.com/neon-bindings/neon/pull/879)

## Bug Fixes

* Relax the lifetime constraints on `TypedArray` borrows (https://github.com/neon-bindings/neon/pull/877)
* Allowing missing symbols at load time to support [bun](https://bun.sh) (https://github.com/neon-bindings/neon/pull/914)
* Prevent a panic when an async event is called after the JavaScript runtime has stopped (https://github.com/neon-bindings/neon/pull/913)
* Fix a soundness hole in `JsArrayBuffer::external` and `JsBuffer::external` (https://github.com/neon-bindings/neon/pull/897)

## Docs

* Fixed mistake in `Object::get` docs (https://github.com/neon-bindings/neon/pull/903)
* Fixed link in README to migration guide (https://github.com/neon-bindings/neon/pull/895)

## Internal

* Moved `cargo-cp-artirfact` into the monorepo (https://github.com/neon-bindings/neon/pull/905)
* Decreased the size of the Neon build matrix (https://github.com/neon-bindings/neon/pull/893)
* Removed scope abstraction from legacy backend (https://github.com/neon-bindings/neon/pull/888)
* Improved the monorepo structure of neon (https://github.com/neon-bindings/neon/pull/884)

# Version 0.10.1

Fix a soundness hole in `JsArrayBuffer::external`
and `JsBuffer::external` (https://github.com/neon-bindings/neon/pull/897).

Thanks to [@Cassy343](https://github.com/Cassy343) for finding the [issue](https://github.com/neon-bindings/neon/issues/896)!

In previous versions of Neon, it was possible to create a `JsArrayBuffer` or `JsBuffer` that references data without the `'static` lifetime.

```rust
pub fn soundness_hole(mut cx: FunctionContext) -> JsResult<JsArrayBuffer> {
    let mut data = vec![0u8, 1, 2, 3];

    // Creating an external from `&mut [u8]` instead of `Vec<u8>` since there is a blanket impl
    // of `AsMut<T> for &mut T`
    let buf = JsArrayBuffer::external(&mut cx, data.as_mut_slice());

    // `buf` is still holding a reference to `data`!
    drop(data);

    Ok(buf)
}
```

# Version 0.10

See the [Neon 0.10 Migration Guide](docs/MIGRATION_GUIDE_0.10.md) for more details about new features and breaking changes.

## Features

* New [buffer borrowing API](https://github.com/neon-bindings/neon/pull/780)
* Added [JoinHandle](https://github.com/neon-bindings/neon/pull/787) for `Channel::send`
* [`JsPromise` and `TaskBuilder`](https://github.com/neon-bindings/neon/pull/789)
* Handle [panics and exceptions](https://github.com/neon-bindings/neon/pull/808) in Channels and Tasks
* [Function call / construct builders](https://github.com/neon-bindings/neon/pull/829)
  and [simplify low level call](https://github.com/neon-bindings/neon/pull/825)
* Create [functions from closures](https://github.com/neon-bindings/neon/pull/811)

## Minor Improvements

* [Performance improvements](https://github.com/neon-bindings/neon/pull/815)
* [Rename N-API to Node-API](https://github.com/neon-bindings/neon/pull/753) in docs to match Node changes
* Remove unused [cslice dependency](https://github.com/neon-bindings/neon/pull/794)
* Switch to [`syn-mid`](https://github.com/neon-bindings/neon/pull/814) for faster compile times
* Downcast in [`Object::get`](https://github.com/neon-bindings/neon/pull/839)
* Added [migration guide](https://github.com/neon-bindings/neon/pull/859)
* Added [`Object::get_opt` and `Object::get_value`](https://github.com/neon-bindings/neon/pull/867)

## Fixes

* [Safety] Make it harder to store and forge [Throw](https://github.com/neon-bindings/neon/pull/797)
* [Soundness] [Make `JsValue` types `!Copy`](https://github.com/neon-bindings/neon/pull/832)
* [Soundness] [Tag `Root`](https://github.com/neon-bindings/neon/pull/847) with instance id
* `create-neon` no longer [leaves partial project on disk](https://github.com/neon-bindings/neon/pull/840)
* Fix legacy backend on [Electron and Windows](https://github.com/neon-bindings/neon/pull/785)
* [FreeBSD support](https://github.com/neon-bindings/neon/pull/856) on legacy backend

## Internal Improvements

* Replace Electron tests [with Playwright](https://github.com/neon-bindings/neon/pull/835)
* Re-organize Neon into an [npm workspace](https://github.com/neon-bindings/neon/pull/852)
* [Fix crates.io badge](https://github.com/neon-bindings/neon/pull/781)
* [Doc test fixes](https://github.com/neon-bindings/neon/pull/800)
* Fix [broken link](https://github.com/neon-bindings/neon/pull/804) in the README

# Version 0.9.1

* Expose the `Finalize` trait as `neon::types::Finalize` so that docs are visible
* Improved docs and build scripts in `create-neon` to make release builds more
  discoverable (https://github.com/neon-bindings/neon/pull/771)
* Update `nan` to fix an Electron 13 incompatibility (https://github.com/neon-bindings/neon/pull/778)

# Version 0.9.0

## Performance

`Channel`, formerly `EventQueue`, are now cloneable. Clones share a backing queue to take advantage of an [optimization](https://github.com/nodejs/node/pull/38506) in Node threadsafe functions. Additionally, when specifying Node API 6 or higher (`napi-6`), calling `cx.channel()` will return a shared queue (https://github.com/neon-bindings/neon/pull/739).

The change may cause a performance regression in some pathological use cases (https://github.com/neon-bindings/neon/issues/762).

## Deprecation

`EventQueue` and `EventQueueError` have been renamed to `Channel` and `ChannelError` respectively to clarify their function and similarity to Rust channels. The types are available as deprecated aliases (https://github.com/neon-bindings/neon/pull/752).

## Docs

* Document error causes for `Channel::try_send` docs (https://github.com/neon-bindings/neon/pull/767)
* Document `neon::object` (https://github.com/neon-bindings/neon/pull/740)

## Fixes

* Fix usage of a removed API in legacy buffers (https://github.com/neon-bindings/neon/pull/769)

# Version 0.8.3

* Fix crash caused by non-thread safety in napi_threadsafefunction on early termination (https://github.com/neon-bindings/neon/pull/744)
* Fix memory leak in `Root` (https://github.com/neon-bindings/neon/pull/750)

# Version 0.8.2

* More docs improvements
* Added a deprecation warning to `neon new` (https://github.com/neon-bindings/neon/pull/722)

# Version 0.8.1

* Fix `legacy-backend` for Node 16 (https://github.com/neon-bindings/neon/pull/715)
* Various docs improvements

# Version 0.8.0

## Fixes

* `as_slice` and `as_mut_slice` properly handle a `null` pointer from an empty buffer (https://github.com/neon-bindings/neon/pull/681)
* Global drop queue added to avoid panics on N-API 6+ when dropping a `Root` (https://github.com/neon-bindings/neon/pull/700)

## Features

* Added `neon::reflect::eval` (https://github.com/neon-bindings/neon/pull/692)
* Added `create-neon` for creating an N-API project (https://github.com/neon-bindings/neon/pull/690)
* Added details to the `README.md` generated by `create-neon` (https://github.com/neon-bindings/neon/pull/697)

## Improvements

* Switched N-API tests to `cargo-cp-artifact` (https://github.com/neon-bindings/neon/pull/687)
* Added `impl<T: Finalize> Finalize for Option<T>` (https://github.com/neon-bindings/neon/pull/680)
* Added a N-API migration guide (https://github.com/neon-bindings/neon/pull/685)

## Housekeeping

* Lint fixes (https://github.com/neon-bindings/neon/pull/609)
* Lint CI enforcement and `cargo fmt` (https://github.com/neon-bindings/neon/pull/698)

# Version 0.7.1

### Features

* Added `JsDate` to N-API backend (https://github.com/neon-bindings/neon/pull/639)
* Implement `JsBuffer::unitialized` for N-API backend (https://github.com/neon-bindings/neon/pull/664)

### Fixes

* Do not panic if a `Root` is leaked after the event loop has stopped (https://github.com/neon-bindings/neon/pull/677)
* Stubs for features that will not be implemented in the N-API backend are removed (https://github.com/neon-bindings/neon/pull/663)
* Fix doc URL link (https://github.com/neon-bindings/neon/pull/663)

# Version 0.7.0

## N-API

### Version Selection

Neon supports a large number of different Node versions which may have different N-API requirements. Neon now supports selecting the minimum required N-API version required by a module. For example, for N-API Version 4:

```toml
neon = { version = "0.7", default-features = false, features = ["napi-4"] }
```

If the Neon module is loaded in an older version of Node that does not support that N-API version, a `panic` message will inform the user.

### Threadsafe Functions

A prerelease version of `EventQueue` for calling into the main JavaScript thread from Rust threads can be enabled with the `event-queue-api` feature flag. The API is considered unstable and may change in the future until the [RFC](https://github.com/neon-bindings/rfcs/pull/32) is merged.

# Version 0.6.0

The `cx.try_catch(..)` API has been updated to return `T: Sized` instead of `T: Value` (https://github.com/neon-bindings/neon/pull/631). This API is strictly more powerful and allows users to return both JavaScript and Rust values from `try_catch` closures.

## N-API

* N-API symbols are now loaded dynamically (https://github.com/neon-bindings/neon/pull/646)
* Build process for N-API is greatly simplified by leveraging dynamic loading (https://github.com/neon-bindings/neon/pull/647)

# Version 0.5.3

## Bug Fixes

Upgrade `node-gyp` (https://github.com/neon-bindings/neon/pull/623)
* Fix Windows Node 15
* Fix Apple M1

## Features

Added `neon::main` macro as a replacement for `register_module!` (https://github.com/neon-bindings/neon/pull/636)

## Known Issues

Builds occassionally fail with Windows, Node 15 and npm 7 (https://github.com/neon-bindings/neon/issues/642)

# Version 0.5.2

## CLI

Added support for [additional arguments](https://github.com/neon-bindings/neon/pull/633) passed to `cargo build`. Resolves https://github.com/neon-bindings/neon/issues/471.

```sh
neon build --release -- --features awesome
```

## N-API

* Improved [arguments performance](https://github.com/neon-bindings/neon/pull/610)
* Add [redirect and `NPM_CONFIG_DISTURL`](https://github.com/neon-bindings/neon/pull/620) support

# Version 0.5.1

## Performance

* `smallvec` is used for collecting arguments and yields a small performance gain when calling `JsFunction`

## Broader Support

Thanks to @staltz, neon now builds for both iOS and Android with [nodejs-mobile](https://github.com/JaneaSystems/nodejs-mobile).

# Version 0.5.0

_Re-publish_

Versions `0.4.1` and `0.4.2` included a breaking change in `neon-runtime`. At the time, this was considered acceptable because `neon-runtime` is considered an internal crate and not part of the public API. However, it was discovered, after publishing, that `neon-serde`, a commonly used crate in the `neon` ecosystem, contained a direct dependency on `neon-runtime`. In order to best support users, versions `0.4.1` and `0.4.2` were "yanked" and re-published as `0.5.0`.

Additionally, the team is working with the authors of `neon-serde` to remove the dependency on `neon-runtime` to prevent future issues.

## Bug Fixes

* Fix stack overflow in `DowncastError` `Display` impl (https://github.com/neon-bindings/neon/pull/606)

# Version 0.4.2

_Unpublished / Yanked_

## Bug Fixes

* Fix memory leak and race condition in `EventHandler`

# Version 0.4.1

_Unpublished / Yanked_

## Features

### Try Catch

Added the `cx.try_catch` API of [RFC 29](https://github.com/neon-bindings/rfcs/pull/29). This feature is behind the `try-catch-api` feature flag.

## Bug Fixes

* Pass `async_context` to `node::MakeCallback` (https://github.com/neon-bindings/neon/pull/498)
* Cache bust neon if node version changes (https://github.com/neon-bindings/neon/pull/388)
* Fix debug builds in windows (https://github.com/neon-bindings/neon/pull/400)
* Fix cross compiling architectures (https://github.com/neon-bindings/neon/pull/491)
* Fix neon new hanging on Windows (https://github.com/neon-bindings/neon/pull/537)

## CI Improvements

The Neon Project now uses Github Actions thanks to @lhr0909! As part of this change, CI now runs on all of our supported platforms (macOS, Windows, linux) and Node versions.

# Version ✨0.4✨ 🎉

## `EventHandler` API

The [`EventHandler` API](https://github.com/neon-bindings/rfcs/blob/main/text/0025-event-handler.md) is a new feature for scheduling work on the javascript main thread from other threads. Big thanks to @geovie for the RFC and implementation.

This feature is currently _unstable_ and gated by a `event-handler-api` feature flag.

## Improvements

* New project template updated for Rust 2018

## Bug Fixes

* Workaround for nodejs/node-gyp#1933
* Docs build fixed
* Temporarily disable static tests which keep breaking CI

## N-API

* Context/Isolate threading
* Scopes
* Strings
* Primitive values (numbers, undefined, null, boolean)

# Version 0.3.3

Hot fix for `neon build` in projects with many dependencies.

# Version 0.3.2

## Bug fixes and Small Features

* Disable node module registration on test build, allowing `cargo test` to be used on neon modules
* Added support for alternate `CARGO_TARGET_DIR` locations (e.g., workspaces)
* Added macros to `neon::prelude` to improve ergonomics in Rust 2018
* Link `win_delay_hook` when building with `electron-build-env`, fixing Windows Electron
* Fixed missing `__cxa_pure_virtual` on Linux
* Copy native files into `OUT_DIR` and build there to fix `cargo publish` and follow best practices
* Eliminated `mem::uniitialized()` usage, reducing warnings and fixing an instance of undefined behavior

## Potentially Breaking

The macOS link arguments were moved from `neon-cli` to `neon-build`. This is more idiomatic, but makes `neon-build` _required_ for macOS builds where it was unnecessary before.

Since `neon-build` has been included in the project template since `0.1` this change was not deemed significant enough to warrant a major revision.

## N-API

Neon 0.3.2 lays the groundwork for the next major revision. Development of Neon against an ABI stable Node API (N-API) will occur on main.

* Added `legacy-runtime` and `n-api` feature flags for toggling neon runtime
* Moved the legacy runtime to `nodejs-sys` crate
* Stubbed required `n-api` implementation
* Added `feature` flag to `neon-cli` to help configuring `n-api` projects

# Version 0.3.1

* Build v0.3 project templates by default in the CLI

# Version 0.3

## Breaking Changes

* [Removed support for Node 6](https://github.com/neon-bindings/neon/pull/420)

## Bug Fixes

* Correctly fail the build if [custom build command fails](https://github.com/neon-bindings/neon/pull/421)
* Fix breaking changes with v8 [`GetFunction`](https://github.com/neon-bindings/neon/pull/410)
* Moved `nan` from `devDependencies` to `dependencies` in [`neon-runtime`](https://github.com/neon-bindings/neon/pull/367)
* Changed neon [crate type](https://github.com/neon-bindings/neon/pull/358) from `dylib` to `cdylib`
* Ensure that neon module loading is [not optimized away](https://github.com/neon-bindings/neon/pull/392)

## Improvements

* Added support for [`CARGO_BUILD_TARGET` environment variable](https://github.com/neon-bindings/neon/pull/411)

# Version ✨0.2✨ 🎉

See the [Neon 0.2 Migration Guide](https://github.com/neon-bindings/neon/wiki/Neon-0.2-Migration-Guide) for documentation on migrating your projects from the Neon 0.1.x series to Neon 0.2, and please [let us know](https://github.com/neon-bindings/neon#get-involved) if you need help!

* Release automation (#318)
* New `ArrayBuffer` views API -- see [RFC 5](https://github.com/neon-bindings/rfcs/blob/main/text/0005-array-buffer-views.md) (#306)
* VM 2.0 -- see [RFC 14](https://github.com/neon-bindings/rfcs/blob/main/text/0014-vm-2.0.md) (#306)
* New `JsString` constructor -- see [RFC 21](https://github.com/neon-bindings/rfcs/blob/main/text/0021-string-constructor.md) (#322)
* Eliminated `JsInteger`, `JsVariant`, `callee()` -- see [RFC 22](https://github.com/neon-bindings/rfcs/blob/main/text/0022-zero-dot-two.md) (#323)
* Renamed `Key` to `PropertyKey` and its method names -- see [RFC 22](https://github.com/neon-bindings/rfcs/blob/main/text/0022-zero-dot-two.md) (#323)
* Module reorganization -- see [RFC 20](https://github.com/neon-bindings/rfcs/blob/main/text/0020-module-reorg.md) (#324)
* New `JsError` API -- see [RFC 23](https://github.com/neon-bindings/rfcs/blob/main/text/0023-error-subtyping.md) (#325)
* Eliminated `ToJsString` API -- see [RFC 22](https://github.com/neon-bindings/rfcs/blob/main/text/0022-zero-dot-two.md) (#326)
* Eliminated `NEON_NODE_ABI` env var -- see [RFC 22](https://github.com/neon-bindings/rfcs/blob/main/text/0022-zero-dot-two.md) (#327)
* Default to release builds -- see [RFC 22](https://github.com/neon-bindings/rfcs/blob/main/text/0022-zero-dot-two.md) (#328)
* Made `Buffer` construction safe by default (#329, #331)
* Made `Throw` not implement `std::error::Error` to avoid accidental suppression, thanks to [@kjvalencik](https://github.com/kjvalencik) (#334)
* Fixed a bug causing unnecessary rebuilds, thanks to [@kjvalencik](https://github.com/kjvalencik) (#343)
* Fixed a soundness bug in the `Task` API, thanks to [@kjvalencik](https://github.com/kjvalencik) (#335)

# Version 0.1.23

* Optimization in `Scope` structures, thanks to [@maciejhirsz](https://github.com/maciejhirsz) (#282)
* Fixed a memory leak in the `Task` API, thanks to [@kjvalencik](https://github.com/kjvalencik) (#291)
* Add support for Node 10, thanks to [@mhsjlw](https://github.com/mhsjlw) and [@nomadtechie](https://github.com/nomadtechie) (#314)

# Version 0.1.22

* Reinstate `JsInteger` (although it's deprecated) for now, to be removed in 0.2. (#279)

# Version 0.1.21

* Fix a bug that was causing annoying unnecessary rebuilds ([#242](https://github.com/neon-bindings/neon/issues/242)).
* New [API for getting the global object](https://api.neon-bindings.com/neon/scope/trait.scope#method.global) ([#249](https://github.com/neon-bindings/neon/issues/249)).

# Version 0.1.20

* Background task API ([#214](https://github.com/neon-bindings/neon/pull/214)).
* Fixes to Windows builds ([#221](https://github.com/neon-bindings/neon/pull/221), [#227](https://github.com/neon-bindings/neon/pull/227)), thanks to [@hone](https://github.com/hone)'s tenacious troubleshooting.

# Version 0.1.19

* TypeScript upgrade fixes ([neon-bindings/neon-cli#62](https://github.com/neon-bindings/neon-cli/pull/62), [neon-bindings/neon-cli#65](https://github.com/neon-bindings/neon-cli/pull/65)).

# Version 0.1.18

* CLI bugfix ([neon-bindings/neon-cli#59](https://github.com/neon-bindings/neon-cli/pull/59)).
* JsArrayBuffer ([#210](https://github.com/neon-bindings/neon/pull/210)).

# Version 0.1.17

* CLI bugfix ([neon-bindings/neon-cli#57](https://github.com/neon-bindings/neon-cli/pull/57)).

# Version 0.1.16

* CLI bugfix ([neon-bindings/neon-cli#56](https://github.com/neon-bindings/neon-cli/pull/56)).

# Version 0.1.15 (2017-05-21)

* Better Electron support in CLI's build process.
* Better support for Electron via the artifacts file ([neon-bindings/neon-cli#52](https://github.com/neon-bindings/neon-cli/pull/52)).

# Version 0.1.14 (2017-04-02)

* Ensure failing tests break the build ([#191](https://github.com/neon-bindings/neon/pull/191))
* Catch Rust panics and convert them to JS exceptions ([#192](https://github.com/neon-bindings/neon/pull/192))
* Implement `Error` for `Throw` ([#201](https://github.com/neon-bindings/neon/pull/191))
* Clean up the CLI and allow `neon build` to optionally take module names ([neon-bindings/neon-cli#48](https://github.com/neon-bindings/neon-cli/pull/48)).

# Version 0.1.13 (2017-02-17)

* More robust build scripts for neon-runtime, fixing Homebrew node installations (see [#189](https://github.com/neon-bindings/neon/pull/189))

# Version 0.1.12 (2017-02-16)

* [Optimized rooting protocol](https://github.com/neon-bindings/neon/commit/cef41584d9978eda2d59866a077cfe7c7d3fa46e)
* [Eliminate rustc warnings](https://github.com/neon-bindings/neon/pull/107)
* Lots of internal API docs
* Windows support! :tada:
* [Renamed `neon-sys` to `neon-runtime`](https://github.com/neon-bindings/neon/issues/169)
* Depend on `neon-build` as a build dependency (see [neon-bindings/neon-cli#46](https://github.com/neon-bindings/neon-cli/issues/46)).

# Version 0.1.11 (2016-08-08)

* [Exposed `This` trait](https://github.com/neon-bindings/neon/issues/101) to allow user-level abstractions involving `FunctionCall`
* Bump version to match Neon so they can be kept in sync from now on.
* Generate a `build.rs` to make Windows work (see [neon-bindings/neon-cli#42](https://github.com/neon-bindings/neon-cli/pull/42) and [neon-bindings/neon-cli#44](https://github.com/neon-bindings/neon-cli/issues/44)).

# Version 0.1.10 (2016-05-11)

* Added `JsError` API with support for throwing [all](https://github.com/neon-bindings/neon/issues/65) [standard](https://github.com/neon-bindings/neon/issues/66) [error](https://github.com/neon-bindings/neon/issues/67) [types](https://github.com/neon-bindings/neon/issues/74)
* [Test harness and CI integration](https://github.com/neon-bindings/neon/issues/80)!! :tada: :tada: :tada:
* API to [call JS functions from Rust](https://github.com/neon-bindings/neon/issues/60)
* API to [new JS functions from Rust](https://github.com/neon-bindings/neon/issues/61)
* Added [generalized `as_slice` and `as_mut_slice` methods](https://github.com/neon-bindings/neon/issues/64) to `CSlice` API.
* Fixed a [soundness issue](https://github.com/neon-bindings/neon/issues/64) with Locks.

## Incompatible Changes

* The `JsTypeError` type is gone, and replaced by the more general `JsError` type.
* `neon::js::error::JsTypeError::throw(msg)` is now `neon::js::error::JsError::throw(neon::js::error::kind::TypeError, msg)`


================================================
FILE: bench/.gitignore
================================================
index.node
npm-debug.log*
cargo.log
cross.log


================================================
FILE: bench/Cargo.toml
================================================
[package]
name = "bench"
version = "0.1.0"
description = "Neon performance regression suite"
authors = ["David Herman <david.herman@gmail.com>"]
license = "MIT"
edition = "2021"
exclude = ["index.node"]

[lib]
crate-type = ["cdylib"]

# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html

[dependencies]
neon = { path = "../crates/neon" }


================================================
FILE: bench/README.md
================================================
# bench: Neon performance regression suite

## Building bench

To run the build, run:

```sh
$ npm run build
```

## Running the benchmarks

To run the benchmarks, run:

```sh
$ npm run benchmark
```


================================================
FILE: bench/index.js
================================================
const { Suite, jsonReport } = require("bench-node");
const addon = require("./index.node");

function median(values) {
  const sorted = [...values].sort((a, b) => a - b);
  const n = sorted.length;
  return n % 2 === 0
    ? (sorted[n / 2 - 1] + sorted[n / 2]) / 2
    : sorted[Math.floor(n / 2)];
}

// A custom reporter for the bencher.dev benchmarking platform.
// Format: https://bencher.dev/docs/reference/bencher-metric-format/
//
// The reporter provides two measures for each benchmark:
// - "throughput": The number of operations per second.
// - "latency": The time taken to perform an operation, in ns.
//   * "value": The median value of all samples.
//   * "lower_value": The minimum value of all samples.
//   * "upper_value": The maximum value of all samples.
function reportBencherDev(results) {
  const bmf = Object.create(null);
  for (const result of results) {
    bmf[result.name] = {
      throughput: {
        value: result.opsSec,
      },
      latency: {
        value: median(result.histogram.sampleData),
        lower_value: result.histogram.min,
        upper_value: result.histogram.max,
      },
    };
  }
  console.log(JSON.stringify(bmf, null, 2));
}

const suite = new Suite({ reporter: reportBencherDev });

suite.add("hello-world", () => {
  addon.hello();
});

suite.add("manually-exported-noop", () => {
  addon.manualNoop();
});

suite.add("auto-exported-noop", () => {
  addon.exportNoop();
});

function triple(s, n, b) {
  return [s, n, b];
}

suite.add("JsFunction::call", () => {
  addon.callCallbackWithCall(triple);
});

suite.add("JsFunction::call_with", () => {
  addon.callCallbackWithCallWith(triple);
});

suite.add("JsFunction::bind", () => {
  addon.callCallbackWithBind(triple);
});

suite.run();


================================================
FILE: bench/package.json
================================================
{
  "name": "bench",
  "private": true,
  "description": "Neon performance regression suite",
  "main": "index.js",
  "scripts": {
    "benchmark": "node --allow-natives-syntax index.js",
    "cargo-build": "cargo build --message-format=json-render-diagnostics > cargo.log",
    "postcargo-build": "neon dist < cargo.log",
    "build": "npm run cargo-build -- --release"
  },
  "author": "David Herman <david.herman@gmail.com>",
  "devDependencies": {
    "@neon-rs/cli": "0.1.82"
  },
  "repository": {
    "type": "git",
    "url": "git+https://github.com/neon-bindings/neon.git"
  },
  "bugs": {
    "url": "https://github.com/neon-bindings/neon/issues"
  },
  "homepage": "https://github.com/neon-bindings/neon#readme",
  "dependencies": {
    "bench-node": "^0.5.4"
  }
}


================================================
FILE: bench/src/lib.rs
================================================
use neon::prelude::*;

#[neon::export]
fn export_noop() {}

fn manual_noop(mut cx: FunctionContext) -> JsResult<JsUndefined> {
    Ok(cx.undefined())
}

fn hello(mut cx: FunctionContext) -> JsResult<JsString> {
    Ok(cx.string("hello node"))
}

fn call_callback_with_call(mut cx: FunctionContext) -> JsResult<JsValue> {
    let f = cx.argument::<JsFunction>(0)?;
    let s = cx.string("hello node");
    let n = cx.number(17.0);
    let b = cx.boolean(true);
    let this = cx.null();
    let args = vec![s.upcast(), n.upcast(), b.upcast()];
    f.call(&mut cx, this, args)
}

fn call_callback_with_call_with(mut cx: FunctionContext) -> JsResult<JsValue> {
    let f = cx.argument::<JsFunction>(0)?;
    f.call_with(&cx)
        .this(cx.null())
        .arg(cx.string("hello node"))
        .arg(cx.number(17.0))
        .arg(cx.boolean(true))
        .apply(&mut cx)
}

fn call_callback_with_bind(mut cx: FunctionContext) -> JsResult<JsValue> {
    let f = cx.argument::<JsFunction>(0)?;
    let this = cx.null();
    f.bind(&mut cx)
        .this(this)?
        .arg("hello node")?
        .arg(17.0)?
        .arg(true)?
        .call()
}

#[neon::main]
fn main(mut cx: ModuleContext) -> NeonResult<()> {
    // Export all macro-registered exports
    neon::registered().export(&mut cx)?;

    cx.export_function("hello", hello)?;
    cx.export_function("manualNoop", manual_noop)?;
    cx.export_function("callCallbackWithCall", call_callback_with_call)?;
    cx.export_function("callCallbackWithCallWith", call_callback_with_call_with)?;
    cx.export_function("callCallbackWithBind", call_callback_with_bind)?;

    Ok(())
}


================================================
FILE: codecov.yml
================================================
ignore:
  - "bench"
  - "test"
coverage:
  status:
    project: off
    patch: off


================================================
FILE: crates/neon/Cargo.toml
================================================
[package]
name = "neon"
version = "1.1.1"
authors = ["Dave Herman <david.herman@gmail.com>"]
description = "A safe abstraction layer for Node.js."
readme = "../../README.md"
homepage = "https://www.neon-bindings.com"
repository = "https://github.com/neon-bindings/neon"
license = "MIT/Apache-2.0"
exclude = ["neon.jpg", "doc/**/*"]
edition = "2021"

[dev-dependencies]
itertools = "0.10.5"
semver = "1.0.20"
psd = "0.3.4"        # used for a doc example
anyhow = "1.0.75"    # used for a doc example
widestring = "1.0.2" # used for a doc example
linkify = "0.10.0"   # used for a doc example
easy-cast = "0.5.2"  # used for a doc example

[target.'cfg(not(target = "windows"))'.dev-dependencies]
# Avoid `clang` as a dependency on windows
nodejs-sys = "0.15.0"

[dependencies]
either = "1.13.0"
getrandom = { version = "0.2.11", optional = true }
libloading = "0.8.1"
linkme = "0.3.33"
semver = "1.0.20"
smallvec = "1.11.2"
once_cell = "1.18.0"
neon-macros = { version = "=1.1.1", path = "../neon-macros" }
aquamarine = { version = "0.3.2", optional = true }
easy-cast = { version = "0.5.2", optional = true }
doc-comment = { version = "0.3.3", optional = true }
send_wrapper = "0.6.0"
serde = { version = "1.0.197", optional = true }
serde_json = { version = "1.0.114", optional = true }

[dependencies.tokio]
version = "1.34.0"
default-features = false
features = ["sync"]
optional = true

[features]
default = ["napi-8"]

# Enable extracting values by serializing to JSON
serde = ["dep:serde", "dep:serde_json"]

# Enable the creation of external binary buffers. This is disabled by default
# since these APIs fail at runtime in environments that enable the V8 memory
# cage (such as Electron: https://www.electronjs.org/blog/v8-memory-cage).
external-buffers = []

# Experimental Rust Futures API
# https://github.com/neon-bindings/rfcs/pull/46
futures = ["dep:tokio"]

# Enable low-level system APIs. The `sys` API allows augmenting the Neon API
# from external crates.
sys = []

# Enable async runtime
tokio = ["tokio-rt-multi-thread"] # Shorter alias
tokio-rt = ["futures", "tokio/rt"]
tokio-rt-multi-thread = ["tokio-rt", "tokio/rt-multi-thread"]

# Default N-API version. Prefer to select a minimum required version.
# DEPRECATED: This is an alias that should be removed
napi-runtime = ["napi-8"]

# Select the N-API version
# Feature flags to enable the experimental N-API runtime. For now, this feature
# is disabled by default.
# The Node N-API documentation specifies N-API and Node version requirements
# https://nodejs.org/api/n-api.html
napi-1 = []
napi-2 = ["napi-1"]
napi-3 = ["napi-2"]
napi-4 = ["napi-3"]
napi-5 = ["napi-4"]
napi-6 = ["napi-5"]
napi-7 = ["napi-6"]
napi-8 = ["napi-7", "getrandom"]
napi-latest = ["napi-8"]
napi-experimental = ["napi-8"]

# Enables the optional dependencies that are only used for generating the API docs.
doc-dependencies = ["doc-comment", "aquamarine", "easy-cast"]

[package.metadata.docs.rs]
rustdoc-args = ["--cfg", "docsrs"]
features = [
    "external-buffers",
    "futures",
    "napi-experimental",
    "doc-dependencies",
    "sys",
]


================================================
FILE: crates/neon/src/context/internal.rs
================================================
use std::{cell::RefCell, ffi::c_void, mem::MaybeUninit};

use crate::{
    context::{Cx, ModuleContext},
    handle::Handle,
    result::NeonResult,
    sys::{self, raw},
    types::{private::ValueInternal, JsObject},
};

#[repr(C)]
#[derive(Clone, Copy)]
pub struct Env(raw::Env);

impl From<raw::Env> for Env {
    fn from(env: raw::Env) -> Self {
        Self(env)
    }
}

thread_local! {
    #[allow(unused)]
    pub(crate) static IS_RUNNING: RefCell<bool> = const { RefCell::new(false) };
}

impl Env {
    pub(crate) fn to_raw(self) -> raw::Env {
        let Self(ptr) = self;
        ptr
    }

    pub(super) unsafe fn try_catch<T, F>(self, f: F) -> Result<T, raw::Local>
    where
        F: FnOnce() -> Result<T, crate::result::Throw>,
    {
        let result = f();
        let mut local: MaybeUninit<raw::Local> = MaybeUninit::zeroed();

        if sys::error::catch_error(self.to_raw(), local.as_mut_ptr()) {
            Err(local.assume_init())
        } else if let Ok(result) = result {
            Ok(result)
        } else {
            panic!("try_catch: unexpected Err(Throw) when VM is not in a throwing state");
        }
    }
}

pub trait ContextInternal<'cx>: Sized {
    fn cx(&self) -> &Cx<'cx>;
    fn cx_mut(&mut self) -> &mut Cx<'cx>;
    fn env(&self) -> Env {
        self.cx().env
    }
}

fn default_main(mut cx: ModuleContext) -> NeonResult<()> {
    #[cfg(all(feature = "napi-6", feature = "tokio-rt-multi-thread"))]
    crate::executor::tokio::init(&mut cx)?;
    crate::registered().export(&mut cx)
}

fn init(cx: ModuleContext) -> NeonResult<()> {
    if crate::macro_internal::MAIN.len() > 1 {
        panic!("The `neon::main` macro must only be used once");
    }

    if let Some(main) = crate::macro_internal::MAIN.first() {
        main(cx)
    } else {
        default_main(cx)
    }
}

#[no_mangle]
unsafe extern "C" fn napi_register_module_v1(env: *mut c_void, m: *mut c_void) -> *mut c_void {
    let env = env.cast();

    sys::setup(env);

    IS_RUNNING.with(|v| {
        *v.borrow_mut() = true;
    });

    let env = Env(env);
    let exports = Handle::new_internal(JsObject::from_local(env, m.cast()));
    let _ = ModuleContext::with(env, exports, init);

    m
}


================================================
FILE: crates/neon/src/context/mod.rs
================================================
//! Provides runtime access to the JavaScript engine.
//!
//! An _execution context_ represents the current state of a thread of execution in the
//! JavaScript engine. Internally, it tracks things like the set of pending function calls,
//! whether the engine is currently throwing an exception or not, and whether the engine is
//! in the process of shutting down. The context uses this internal state to manage what
//! operations are safely available and when.
//!
//! The [`Context`] trait provides an abstract interface to the JavaScript
//! execution context. All interaction with the JavaScript engine in Neon code is mediated
//! through instances of this trait.
//!
//! One particularly useful context type is [`FunctionContext`], which is passed
//! to all Neon functions as their initial execution context.
//!
//! ```
//! # use neon::prelude::*;
//! fn hello(mut cx: FunctionContext) -> JsResult<JsString> {
//!     Ok(cx.string("hello Neon"))
//! }
//! ```
//!
//! Another important context type is [`ModuleContext`], which is provided
//! to a Neon module's [`main`](crate::main) function to enable sharing Neon functions back
//! with JavaScript:
//!
//! ```
//! # use neon::prelude::*;
//! # fn hello(_: FunctionContext) -> JsResult<JsValue> { todo!() }
//! #[neon::main]
//! fn lib(mut cx: ModuleContext) -> NeonResult<()> {
//!     cx.export_function("hello", hello)?;
//!     Ok(())
//! }
//! ```
//!
//! ## Writing Generic Helpers
//!
//! Depending on the entrypoint, a user may have a [`FunctionContext`], [`ModuleContext`], or
//! generic [`Cx`]. While it is possible to write a helper that is generic over the [`Context`]
//! trait, it is often simpler to accept a [`Cx`] argument. Due to deref coercion, other contexts
//! may be passed into a function that accepts a reference to [`Cx`].
//!
//! ```
//! # use neon::prelude::*;
//! fn log(cx: &mut Cx, msg: &str) -> NeonResult<()> {
//!     cx.global::<JsObject>("console")?
//!         .method(cx, "log")?
//!         .arg(msg)?
//!         .exec()?;
//!     Ok(())
//! }
//!
//! fn print(mut cx: FunctionContext) -> JsResult<JsUndefined> {
//!     let msg = cx.argument::<JsString>(0)?.value(&mut cx);
//!     log(&mut cx, &msg)?;
//!     Ok(cx.undefined())
//! }
//! ```
//!
//! ## Memory Management
//!
//! Because contexts represent the engine at a point in time, they are associated with a
//! [_lifetime_][lifetime], which limits how long Rust code is allowed to access them. This
//! is also used to determine the lifetime of [`Handle`]s, which
//! provide safe references to JavaScript memory managed by the engine's garbage collector.
//!
//! For example, we can
//! write a simple string scanner that counts whitespace in a JavaScript string and
//! returns a [`JsNumber`]:
//!
//! ```
//! # use neon::prelude::*;
//! fn count_whitespace(mut cx: FunctionContext) -> JsResult<JsNumber> {
//!     let s: Handle<JsString> = cx.argument(0)?;
//!     let contents = s.value(&mut cx);
//!     let count = contents
//!         .chars()                       // iterate over the characters
//!         .filter(|c| c.is_whitespace()) // select the whitespace chars
//!         .count();                      // count the resulting chars
//!     Ok(cx.number(count as f64))
//! }
//! ```
//!
//! In this example, `s` is assigned a handle to a string, which ensures that the string
//! is _kept alive_ (i.e., prevented from having its storage reclaimed by the JavaScript
//! engine's garbage collector) for the duration of the `count_whitespace` function. This
//! is how Neon takes advantage of Rust's type system to allow your Rust code to safely
//! interact with JavaScript values.
//!
//! ### Temporary Scopes
//!
//! Sometimes it can be useful to limit the scope of a handle's lifetime, to allow the
//! engine to reclaim memory sooner. This can be important when, for example, an expensive inner loop generates
//! temporary JavaScript values that are only needed inside the loop. In these cases,
//! the [`execute_scoped`](Context::execute_scoped) and [`compute_scoped`](Context::compute_scoped)
//! methods allow you to create temporary contexts in order to allocate temporary
//! handles.
//!
//! For example, to extract the elements of a JavaScript [iterator][iterator] from Rust,
//! a Neon function has to work with several temporary handles on each pass through
//! the loop:
//!
//! ```
//! # use neon::prelude::*;
//! # fn iterate(mut cx: FunctionContext) -> JsResult<JsUndefined> {
//!     let iterator = cx.argument::<JsObject>(0)?;         // iterator object
//!     let next: Handle<JsFunction> =                      // iterator's `next` method
//!         iterator.prop(&mut cx, "next").get()?;
//!     let mut numbers: Vec<f64> = vec![];                 // results vector
//!     let mut done = false;                               // loop controller
//!
//!     while !done {
//!         done = cx.execute_scoped(|mut cx| {                   // temporary scope
//!             let obj: Handle<JsObject> = next                  // temporary object
//!                 .bind(&mut cx)
//!                 .this(iterator)?
//!                 .call()?;
//!             numbers.push(obj.prop(&mut cx, "value").get()?);  // temporary number
//!             obj.prop(&mut cx, "done").get()                   // temporary boolean
//!         })?;
//!     }
//! #   Ok(cx.undefined())
//! # }
//! ```
//!
//! The temporary scope ensures that the temporary values are only kept alive
//! during a single pass through the loop, since the temporary context is
//! discarded (and all of its handles released) on the inside of the loop.
//!
//! ## Throwing Exceptions
//!
//! When a Neon API causes a JavaScript exception to be thrown, it returns an
//! [`Err`] result, indicating that the thread associated
//! with the context is now throwing. This allows Rust code to perform any
//! cleanup before returning, but with an important restriction:
//!
//! > **While a JavaScript thread is throwing, its context cannot be used.**
//!
//! Unless otherwise documented, any Neon API that uses a context (as `self` or as
//! a parameter) immediately panics if called while the context's thread is throwing.
//!
//! Typically, Neon code can manage JavaScript exceptions correctly and conveniently
//! by using Rust's [question mark (`?`)][question-mark] operator. This ensures that
//! Rust code "short-circuits" when an exception is thrown and returns back to
//! JavaScript without calling any throwing APIs.
//!
//! Alternatively, to invoke a Neon API and catch any JavaScript exceptions, use the
//! [`Context::try_catch`] method, which catches any thrown
//! exception and restores the context to non-throwing state.
//!
//! ## See also
//!
//! 1. Ecma International. [Execution contexts](https://tc39.es/ecma262/#sec-execution-contexts), _ECMAScript Language Specification_.
//! 2. Madhavan Nagarajan. [What is the Execution Context and Stack in JavaScript?](https://medium.com/@itIsMadhavan/what-is-the-execution-context-stack-in-javascript-e169812e851a)
//! 3. Rupesh Mishra. [Execution context, Scope chain and JavaScript internals](https://medium.com/@happymishra66/execution-context-in-javascript-319dd72e8e2c).
//!
//! [lifetime]: https://doc.rust-lang.org/book/ch10-00-generics.html
//! [iterator]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Guide/Iterators_and_Generators
//! [question-mark]: https://doc.rust-lang.org/edition-guide/rust-2018/error-handling-and-panics/the-question-mark-operator-for-easier-error-handling.html

pub(crate) mod internal;

use std::{
    convert::Into,
    marker::PhantomData,
    ops::{Deref, DerefMut},
    panic::UnwindSafe,
};

pub use crate::types::buffer::lock::Lock;

use crate::{
    event::TaskBuilder,
    handle::Handle,
    object::Object,
    result::{JsResult, NeonResult, Throw},
    sys::{
        self, raw,
        scope::{EscapableHandleScope, HandleScope},
    },
    types::{
        boxed::{Finalize, JsBox},
        error::JsError,
        extract::{FromArgs, TryFromJs},
        private::ValueInternal,
        Deferred, JsArray, JsArrayBuffer, JsBoolean, JsBuffer, JsFunction, JsNull, JsNumber,
        JsObject, JsPromise, JsString, JsUndefined, JsValue, StringResult, Value,
    },
};

use self::internal::{ContextInternal, Env};

#[cfg(feature = "napi-4")]
use crate::event::Channel;

#[cfg(feature = "napi-5")]
use crate::types::date::{DateError, JsDate};

#[cfg(feature = "napi-6")]
use crate::lifecycle::InstanceData;

#[doc(hidden)]
/// An execution context of a task completion callback.
pub type TaskContext<'cx> = Cx<'cx>;

#[doc(hidden)]
/// An execution context of a scope created by [`Context::execute_scoped()`](Context::execute_scoped).
pub type ExecuteContext<'cx> = Cx<'cx>;

#[doc(hidden)]
/// An execution context of a scope created by [`Context::compute_scoped()`](Context::compute_scoped).
pub type ComputeContext<'cx> = Cx<'cx>;

#[doc(hidden)]
/// A view of the JS engine in the context of a finalize method on garbage collection
pub type FinalizeContext<'cx> = Cx<'cx>;

/// An execution context constructed from a raw [`Env`](crate::sys::bindings::Env).
#[cfg(feature = "sys")]
#[cfg_attr(docsrs, doc(cfg(feature = "sys")))]
#[doc(hidden)]
pub type SysContext<'cx> = Cx<'cx>;

/// Context representing access to the JavaScript runtime
pub struct Cx<'cx> {
    env: Env,
    _phantom_inner: PhantomData<&'cx ()>,
}

impl<'cx> Cx<'cx> {
    /// Creates a context from a raw `Env`.
    ///
    /// # Safety
    ///
    /// Once a [`Cx`] has been created, it is unsafe to use
    /// the `Env`. The handle scope for the `Env` must be valid for
    /// the lifetime `'cx`.
    #[cfg(feature = "sys")]
    #[cfg_attr(docsrs, doc(cfg(feature = "sys")))]
    pub unsafe fn from_raw(env: sys::Env) -> Self {
        Self {
            env: env.into(),
            _phantom_inner: PhantomData,
        }
    }

    fn new(env: Env) -> Self {
        Self {
            env,
            _phantom_inner: PhantomData,
        }
    }

    pub(crate) fn with_context<T, F: for<'b> FnOnce(Cx<'b>) -> T>(env: Env, f: F) -> T {
        f(Self {
            env,
            _phantom_inner: PhantomData,
        })
    }
}

impl<'cx> ContextInternal<'cx> for Cx<'cx> {
    fn cx(&self) -> &Cx<'cx> {
        self
    }

    fn cx_mut(&mut self) -> &mut Cx<'cx> {
        self
    }
}

impl<'cx> Context<'cx> for Cx<'cx> {}

impl<'cx> From<FunctionContext<'cx>> for Cx<'cx> {
    fn from(cx: FunctionContext<'cx>) -> Self {
        cx.cx
    }
}

impl<'cx> From<ModuleContext<'cx>> for Cx<'cx> {
    fn from(cx: ModuleContext<'cx>) -> Self {
        cx.cx
    }
}

#[repr(C)]
pub(crate) struct CallbackInfo<'cx> {
    info: raw::FunctionCallbackInfo,
    _lifetime: PhantomData<&'cx raw::FunctionCallbackInfo>,
}

impl CallbackInfo<'_> {
    pub unsafe fn new(info: raw::FunctionCallbackInfo) -> Self {
        Self {
            info,
            _lifetime: PhantomData,
        }
    }

    fn kind<'b, C: Context<'b>>(&self, cx: &C) -> CallKind {
        if unsafe { sys::call::is_construct(cx.env().to_raw(), self.info) } {
            CallKind::Construct
        } else {
            CallKind::Call
        }
    }

    pub fn len<'b, C: Context<'b>>(&self, cx: &C) -> usize {
        unsafe { sys::call::len(cx.env().to_raw(), self.info) }
    }

    pub fn argv<'b, C: Context<'b>>(&self, cx: &mut C) -> sys::call::Arguments {
        unsafe { sys::call::argv(cx.env().to_raw(), self.info) }
    }

    pub fn this<'b, C: Context<'b>>(&self, cx: &mut C) -> raw::Local {
        let env = cx.env();
        unsafe {
            let mut local: raw::Local = std::mem::zeroed();
            sys::call::this(env.to_raw(), self.info, &mut local);
            local
        }
    }

    pub(crate) fn argv_exact<'b, C: Context<'b>, const N: usize>(
        &self,
        cx: &mut C,
    ) -> [Handle<'b, JsValue>; N] {
        use std::ptr;

        let mut argv = [JsValue::new_internal(ptr::null_mut()); N];
        let mut argc = argv.len();

        // # Safety
        // * Node-API fills empty slots with `undefined`
        // * `Handle` and `JsValue` are transparent wrappers around a raw pointer
        unsafe {
            sys::get_cb_info(
                cx.env().to_raw(),
                self.info,
                &mut argc,
                argv.as_mut_ptr().cast(),
                ptr::null_mut(),
                ptr::null_mut(),
            )
            .unwrap();
        }

        // Empty values will be filled with `undefined`
        argv
    }
}

/// Indicates whether a function was called with `new`.
#[derive(Clone, Copy, Debug)]
pub enum CallKind {
    Construct,
    Call,
}

/// An _execution context_, which represents the current state of a thread of execution in the JavaScript engine.
///
/// All interaction with the JavaScript engine in Neon code is mediated through instances of this trait.
///
/// A context has a lifetime `'a`, which ensures the safety of handles managed by the JS garbage collector. All handles created during the lifetime of a context are kept alive for that duration and cannot outlive the context.
pub trait Context<'a>: ContextInternal<'a> {
    /// Lock the JavaScript engine, returning an RAII guard that keeps the lock active as long as the guard is alive.
    ///
    /// If this is not the currently active context (for example, if it was used to spawn a scoped context with `execute_scoped` or `compute_scoped`), this method will panic.
    fn lock<'b>(&'b mut self) -> Lock<'b, Self>
    where
        'a: 'b,
    {
        Lock::new(self)
    }

    /// Executes a computation in a new memory management scope.
    ///
    /// Handles created in the new scope are kept alive only for the duration of the computation and cannot escape.
    ///
    /// This method can be useful for limiting the life of temporary values created during long-running computations, to prevent leaks.
    fn execute_scoped<'b, T, F>(&mut self, f: F) -> T
    where
        'a: 'b,
        F: FnOnce(Cx<'b>) -> T,
    {
        let env = self.env();
        let scope = unsafe { HandleScope::new(env.to_raw()) };
        let result = f(Cx::new(env));

        drop(scope);

        result
    }

    /// Executes a computation in a new memory management scope and computes a single result value that outlives the computation.
    ///
    /// Handles created in the new scope are kept alive only for the duration of the computation and cannot escape, with the exception of the result value, which is rooted in the outer context.
    ///
    /// This method can be useful for limiting the life of temporary values created during long-running computations, to prevent leaks.
    fn compute_scoped<'b, V, F>(&mut self, f: F) -> JsResult<'a, V>
    where
        'a: 'b,
        V: Value,
        F: FnOnce(Cx<'b>) -> JsResult<'b, V>,
    {
        let env = self.env();
        let scope = unsafe { EscapableHandleScope::new(env.to_raw()) };
        let cx = Cx::new(env);

        let escapee = unsafe { scope.escape(f(cx)?.to_local()) };

        Ok(Handle::new_internal(unsafe {
            V::from_local(self.env(), escapee)
        }))
    }

    fn try_catch<T, F>(&mut self, f: F) -> Result<T, Handle<'a, JsValue>>
    where
        F: FnOnce(&mut Self) -> NeonResult<T>,
    {
        unsafe {
            self.env()
                .try_catch(move || f(self))
                .map_err(JsValue::new_internal)
        }
    }

    /// Convenience method for creating a `JsBoolean` value.
    fn boolean(&mut self, b: bool) -> Handle<'a, JsBoolean> {
        JsBoolean::new(self, b)
    }

    /// Convenience method for creating a `JsNumber` value.
    fn number<T: Into<f64>>(&mut self, x: T) -> Handle<'a, JsNumber> {
        JsNumber::new(self, x.into())
    }

    /// Convenience method for creating a `JsString` value.
    ///
    /// If the string exceeds the limits of the JS engine, this method panics.
    fn string<S: AsRef<str>>(&mut self, s: S) -> Handle<'a, JsString> {
        JsString::new(self, s)
    }

    /// Convenience method for creating a `JsString` value.
    ///
    /// If the string exceeds the limits of the JS engine, this method returns an `Err` value.
    fn try_string<S: AsRef<str>>(&mut self, s: S) -> StringResult<'a> {
        JsString::try_new(self, s)
    }

    /// Convenience method for creating a `JsNull` value.
    fn null(&mut self) -> Handle<'a, JsNull> {
        JsNull::new(self)
    }

    /// Convenience method for creating a `JsUndefined` value.
    fn undefined(&mut self) -> Handle<'a, JsUndefined> {
        JsUndefined::new(self)
    }

    /// Convenience method for creating an empty `JsObject` value.
    fn empty_object(&mut self) -> Handle<'a, JsObject> {
        JsObject::new(self)
    }

    /// Convenience method for creating an empty `JsArray` value.
    fn empty_array(&mut self) -> Handle<'a, JsArray> {
        JsArray::new(self, 0)
    }

    /// Convenience method for creating an empty `JsArrayBuffer` value.
    fn array_buffer(&mut self, size: usize) -> JsResult<'a, JsArrayBuffer> {
        JsArrayBuffer::new(self, size)
    }

    /// Convenience method for creating an empty `JsBuffer` value.
    fn buffer(&mut self, size: usize) -> JsResult<'a, JsBuffer> {
        JsBuffer::new(self, size)
    }
    /// Convenience method for creating a `JsDate` value.
    #[cfg(feature = "napi-5")]
    #[cfg_attr(docsrs, doc(cfg(feature = "napi-5")))]
    fn date(&mut self, value: impl Into<f64>) -> Result<Handle<'a, JsDate>, DateError> {
        JsDate::new(self, value)
    }

    /// Convenience method for looking up a global property by name.
    ///
    /// Equivalent to:
    ///
    /// ```
    /// # use neon::prelude::*;
    /// # fn get_array_global<'cx>(cx: &mut Cx<'cx>) -> JsResult<'cx, JsFunction> {
    /// #     let name = "Array";
    /// #     let v: Handle<JsFunction> =
    /// {
    ///     let global = cx.global_object();
    ///     global.prop(cx, name).get()
    /// }
    /// #     ?;
    /// #     Ok(v)
    /// # }
    /// ```
    fn global<T: Value>(&mut self, name: &str) -> JsResult<'a, T> {
        let global = self.global_object();
        global.get(self, name)
    }

    /// Produces a handle to the JavaScript global object.
    fn global_object(&mut self) -> Handle<'a, JsObject> {
        JsObject::build(|out| unsafe {
            sys::scope::get_global(self.env().to_raw(), out);
        })
    }

    /// Throws a JS value.
    fn throw<T: Value, U>(&mut self, v: Handle<T>) -> NeonResult<U> {
        unsafe {
            sys::error::throw(self.env().to_raw(), v.to_local());
            Err(Throw::new())
        }
    }

    /// Creates a direct instance of the [`Error`](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Error) class.
    fn error<S: AsRef<str>>(&mut self, msg: S) -> JsResult<'a, JsError> {
        JsError::error(self, msg)
    }

    /// Creates an instance of the [`TypeError`](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/TypeError) class.
    fn type_error<S: AsRef<str>>(&mut self, msg: S) -> JsResult<'a, JsError> {
        JsError::type_error(self, msg)
    }

    /// Creates an instance of the [`RangeError`](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/RangeError) class.
    fn range_error<S: AsRef<str>>(&mut self, msg: S) -> JsResult<'a, JsError> {
        JsError::range_error(self, msg)
    }

    /// Throws a direct instance of the [`Error`](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Error) class.
    fn throw_error<S: AsRef<str>, T>(&mut self, msg: S) -> NeonResult<T> {
        let err = JsError::error(self, msg)?;
        self.throw(err)
    }

    /// Throws an instance of the [`TypeError`](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/TypeError) class.
    fn throw_type_error<S: AsRef<str>, T>(&mut self, msg: S) -> NeonResult<T> {
        let err = JsError::type_error(self, msg)?;
        self.throw(err)
    }

    /// Throws an instance of the [`RangeError`](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/RangeError) class.
    fn throw_range_error<S: AsRef<str>, T>(&mut self, msg: S) -> NeonResult<T> {
        let err = JsError::range_error(self, msg)?;
        self.throw(err)
    }

    /// Convenience method for wrapping a value in a `JsBox`.
    ///
    /// # Example:
    ///
    /// ```rust
    /// # use neon::prelude::*;
    /// struct Point(usize, usize);
    ///
    /// impl Finalize for Point {}
    ///
    /// fn my_neon_function(mut cx: FunctionContext) -> JsResult<JsBox<Point>> {
    ///     let point = cx.boxed(Point(0, 1));
    ///
    ///     Ok(point)
    /// }
    /// ```
    fn boxed<U: Finalize + 'static>(&mut self, v: U) -> Handle<'a, JsBox<U>> {
        JsBox::new(self, v)
    }

    #[cfg(feature = "napi-4")]
    #[deprecated(since = "0.9.0", note = "Please use the channel() method instead")]
    #[doc(hidden)]
    fn queue(&mut self) -> Channel {
        self.channel()
    }

    #[cfg(feature = "napi-4")]
    #[cfg_attr(docsrs, doc(cfg(feature = "napi-4")))]
    /// Returns an unbounded channel for scheduling events to be executed on the JavaScript thread.
    ///
    /// When using N-API >= 6,the channel returned by this method is backed by a shared queue.
    /// To create a channel backed by a _new_ queue see [`Channel`].
    fn channel(&mut self) -> Channel {
        #[cfg(feature = "napi-6")]
        let channel = InstanceData::channel(self);

        #[cfg(not(feature = "napi-6"))]
        let channel = Channel::new(self);

        channel
    }

    /// Creates a [`Deferred`] and [`JsPromise`] pair. The [`Deferred`] handle can be
    /// used to resolve or reject the [`JsPromise`].
    ///
    /// ```
    /// # use neon::prelude::*;
    /// fn resolve_promise(mut cx: FunctionContext) -> JsResult<JsPromise> {
    ///     let (deferred, promise) = cx.promise();
    ///     let msg = cx.string("Hello, World!");
    ///
    ///     deferred.resolve(&mut cx, msg);
    ///
    ///     Ok(promise)
    /// }
    /// ```
    fn promise(&mut self) -> (Deferred, Handle<'a, JsPromise>) {
        JsPromise::new(self)
    }

    /// Creates a [`TaskBuilder`] which can be used to schedule the `execute`
    /// callback to asynchronously execute on the
    /// [Node worker pool](https://nodejs.org/en/docs/guides/dont-block-the-event-loop/).
    ///
    /// ```
    /// # use neon::prelude::*;
    /// fn greet(mut cx: FunctionContext) -> JsResult<JsPromise> {
    ///     let name = cx.argument::<JsString>(0)?.value(&mut cx);
    ///
    ///     let promise = cx
    ///         .task(move || format!("Hello, {}!", name))
    ///         .promise(move |mut cx, greeting| Ok(cx.string(greeting)));
    ///
    ///     Ok(promise)
    /// }
    /// ```
    fn task<'cx, O, E>(&'cx mut self, execute: E) -> TaskBuilder<'cx, Self, E>
    where
        'a: 'cx,
        O: Send + 'static,
        E: FnOnce() -> O + Send + 'static,
    {
        TaskBuilder::new(self, execute)
    }

    #[cfg(feature = "sys")]
    #[cfg_attr(docsrs, doc(cfg(feature = "sys")))]
    /// Gets the raw `sys::Env` for usage with Node-API.
    fn to_raw(&self) -> sys::Env {
        self.env().to_raw()
    }
}

/// An execution context of module initialization.
pub struct ModuleContext<'cx> {
    cx: Cx<'cx>,
    exports: Handle<'cx, JsObject>,
}

impl<'cx> Deref for ModuleContext<'cx> {
    type Target = Cx<'cx>;

    fn deref(&self) -> &Self::Target {
        self.cx()
    }
}

impl<'cx> DerefMut for ModuleContext<'cx> {
    fn deref_mut(&mut self) -> &mut Self::Target {
        self.cx_mut()
    }
}

impl<'cx> UnwindSafe for ModuleContext<'cx> {}

impl<'cx> ModuleContext<'cx> {
    pub(crate) fn with<T, F: for<'b> FnOnce(ModuleContext<'b>) -> T>(
        env: Env,
        exports: Handle<'cx, JsObject>,
        f: F,
    ) -> T {
        f(ModuleContext {
            cx: Cx::new(env),
            exports,
        })
    }

    #[cfg(not(feature = "napi-5"))]
    /// Convenience method for exporting a Neon function from a module.
    pub fn export_function<T: Value>(
        &mut self,
        key: &str,
        f: fn(FunctionContext) -> JsResult<T>,
    ) -> NeonResult<()> {
        let value = JsFunction::new(self, f)?.upcast::<JsValue>();
        self.exports.clone().set(self, key, value)?;
        Ok(())
    }

    #[cfg(feature = "napi-5")]
    /// Convenience method for exporting a Neon function from a module.
    pub fn export_function<F, V>(&mut self, key: &str, f: F) -> NeonResult<()>
    where
        F: Fn(FunctionContext) -> JsResult<V> + 'static,
        V: Value,
    {
        let value = JsFunction::new(self, f)?.upcast::<JsValue>();
        // Note: Cloning `exports` is necessary to avoid holding a shared reference to
        // `self` while attempting to use it mutably in `set`.
        self.exports.clone().set(self, key, value)?;
        Ok(())
    }

    /// Exports a JavaScript value from a Neon module.
    pub fn export_value<T: Value>(&mut self, key: &str, val: Handle<T>) -> NeonResult<()> {
        self.exports.clone().set(self, key, val)?;
        Ok(())
    }

    /// Produces a handle to a module's exports object.
    pub fn exports_object(&mut self) -> JsResult<'cx, JsObject> {
        Ok(self.exports)
    }
}

impl<'cx> ContextInternal<'cx> for ModuleContext<'cx> {
    fn cx(&self) -> &Cx<'cx> {
        &self.cx
    }

    fn cx_mut(&mut self) -> &mut Cx<'cx> {
        &mut self.cx
    }
}

impl<'cx> Context<'cx> for ModuleContext<'cx> {}

/// An execution context of a function call.
///
/// The type parameter `T` is the type of the `this`-binding.
pub struct FunctionContext<'cx> {
    cx: Cx<'cx>,
    info: &'cx CallbackInfo<'cx>,

    arguments: Option<sys::call::Arguments>,
}

impl<'cx> Deref for FunctionContext<'cx> {
    type Target = Cx<'cx>;

    fn deref(&self) -> &Self::Target {
        &self.cx
    }
}

impl<'cx> DerefMut for FunctionContext<'cx> {
    fn deref_mut(&mut self) -> &mut Self::Target {
        &mut self.cx
    }
}

impl<'cx> UnwindSafe for FunctionContext<'cx> {}

impl<'cx> FunctionContext<'cx> {
    /// Indicates whether the function was called with `new`.
    pub fn kind(&self) -> CallKind {
        self.info.kind(self)
    }

    pub(crate) fn with<U, F: for<'b> FnOnce(FunctionContext<'b>) -> U>(
        env: Env,
        info: &'cx CallbackInfo<'cx>,
        f: F,
    ) -> U {
        f(FunctionContext {
            cx: Cx::new(env),
            info,
            arguments: None,
        })
    }

    /// Indicates the number of arguments that were passed to the function.
    pub fn len(&self) -> usize {
        self.info.len(self)
    }

    /// Indicates if no arguments were passed to the function.
    pub fn is_empty(&self) -> bool {
        self.len() == 0
    }

    /// Produces the `i`th argument, or `None` if `i` is greater than or equal to `self.len()`.
    pub fn argument_opt(&mut self, i: usize) -> Option<Handle<'cx, JsValue>> {
        let argv = if let Some(argv) = self.arguments.as_ref() {
            argv
        } else {
            let argv = self.info.argv(self);
            self.arguments.insert(argv)
        };

        argv.get(i)
            .map(|v| Handle::new_internal(unsafe { JsValue::from_local(self.env(), v) }))
    }

    /// Produces the `i`th argument and casts it to the type `V`, or throws an exception if `i` is greater than or equal to `self.len()` or cannot be cast to `V`.
    pub fn argument<V: Value>(&mut self, i: usize) -> JsResult<'cx, V> {
        match self.argument_opt(i) {
            Some(v) => v.downcast_or_throw(self),
            None => self.throw_type_error("not enough arguments"),
        }
    }

    /// Produces a handle to the `this`-binding and attempts to downcast as a specific type.
    /// Equivalent to calling `cx.this_value().downcast_or_throw(&mut cx)`.
    ///
    /// Throws an exception if the value is a different type.
    pub fn this<T: Value>(&mut self) -> JsResult<'cx, T> {
        self.this_value().downcast_or_throw(self)
    }

    /// Produces a handle to the function's [`this`-binding](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/this#function_context).
    pub fn this_value(&mut self) -> Handle<'cx, JsValue> {
        JsValue::new_internal(self.info.this(self))
    }

    /// Extract Rust data from the JavaScript arguments.
    ///
    /// This is frequently more efficient and ergonomic than getting arguments
    /// individually. See the [`extract`](crate::types::extract) module documentation
    /// for more examples.
    ///
    /// ```
    /// # use neon::{prelude::*, types::extract::*};
    /// fn add(mut cx: FunctionContext) -> JsResult<JsNumber> {
    ///     let (a, b): (f64, f64) = cx.args()?;
    ///
    ///     Ok(cx.number(a + b))
    /// }
    /// ```
    pub fn args<T>(&mut self) -> NeonResult<T>
    where
        T: FromArgs<'cx>,
    {
        T::from_args(self)
    }

    /// Extract a single argument from a unary function. See [`Context::args`] for more details.
    pub fn arg<T>(&mut self) -> NeonResult<T>
    where
        T: TryFromJs<'cx>,
    {
        self.args::<(T,)>().map(|(v,)| v)
    }

    /// Extract Rust data from the JavaScript arguments.
    ///
    /// Similar to [`FunctionContext::args`], but does not throw a JavaScript exception on errors. Useful
    /// for function overloading.
    ///
    /// ```
    /// # use neon::{prelude::*, types::extract::*};
    /// fn combine(mut cx: FunctionContext) -> JsResult<JsValue> {
    ///     if let Some((a, b)) = cx.args_opt::<(f64, f64)>()? {
    ///         return Ok(cx.number(a + b).upcast());
    ///     }
    ///
    ///     let (a, b): (String, String) = cx.args()?;
    ///
    ///     Ok(cx.string(a + &b).upcast())
    /// }
    /// ```
    pub fn args_opt<T>(&mut self) -> NeonResult<Option<T>>
    where
        T: FromArgs<'cx>,
    {
        T::from_args_opt(self)
    }

    /// Extract a single optional argument from a unary function. See [`Context::args_opt`] for more details.
    pub fn arg_opt<T>(&mut self) -> NeonResult<Option<T>>
    where
        T: TryFromJs<'cx>,
    {
        self.args_opt::<(T,)>().map(|v| v.map(|(v,)| v))
    }

    pub(crate) fn argv<const N: usize>(&mut self) -> [Handle<'cx, JsValue>; N] {
        self.info.argv_exact(self)
    }
}

impl<'cx> ContextInternal<'cx> for FunctionContext<'cx> {
    fn cx(&self) -> &Cx<'cx> {
        &self.cx
    }

    fn cx_mut(&mut self) -> &mut Cx<'cx> {
        &mut self.cx
    }
}

impl<'cx> Context<'cx> for FunctionContext<'cx> {}


================================================
FILE: crates/neon/src/event/channel.rs
================================================
use std::{
    error, fmt,
    sync::{
        atomic::{AtomicUsize, Ordering},
        Arc,
    },
};

use crate::{
    context::{internal::Env, Context, Cx},
    result::{NeonResult, ResultExt, Throw},
    sys::{self, tsfn::ThreadsafeFunction},
};

#[cfg(feature = "futures")]
use {
    std::future::Future,
    std::pin::Pin,
    std::task::{self, Poll},
    tokio::sync::oneshot,
};

#[cfg(not(feature = "futures"))]
// Synchronous oneshot channel API compatible with `tokio::sync::oneshot`
mod oneshot {
    use std::sync::mpsc;

    pub(super) mod error {
        pub use super::mpsc::RecvError;
    }

    pub(super) struct Receiver<T>(mpsc::Receiver<T>);

    impl<T> Receiver<T> {
        pub(super) fn blocking_recv(self) -> Result<T, mpsc::RecvError> {
            self.0.recv()
        }
    }

    pub(super) fn channel<T>() -> (mpsc::SyncSender<T>, Receiver<T>) {
        let (tx, rx) = mpsc::sync_channel(1);

        (tx, Receiver(rx))
    }
}

type Callback = Box<dyn FnOnce(sys::Env) + Send + 'static>;

/// Channel for scheduling Rust closures to execute on the JavaScript main thread.
///
/// Cloning a `Channel` will create a new channel that shares a backing queue for
/// events.
///
/// # Example
///
/// The following example spawns a standard Rust thread to complete a computation
/// and calls back to a JavaScript function asynchronously with the result.
///
/// ```
/// # use neon::prelude::*;
/// # fn fibonacci(_: f64) -> f64 { todo!() }
/// fn async_fibonacci(mut cx: FunctionContext) -> JsResult<JsUndefined> {
///     // These types (`f64`, `Root<JsFunction>`, `Channel`) may all be sent
///     // across threads.
///     let n = cx.argument::<JsNumber>(0)?.value(&mut cx);
///     let callback = cx.argument::<JsFunction>(1)?.root(&mut cx);
///     let channel = cx.channel();
///
///     // Spawn a thread to complete the execution. This will _not_ block the
///     // JavaScript event loop.
///     std::thread::spawn(move || {
///         let result = fibonacci(n);
///
///         // Send a closure as a task to be executed by the JavaScript event
///         // loop. This _will_ block the event loop while executing.
///         channel.send(move |mut cx| {
///             let callback = callback.into_inner(&mut cx);
///
///             callback
///                 .bind(&mut cx)
///                 .args(((), result))?
///                 .exec()?;
///
///             Ok(())
///         });
///     });
///
///     Ok(cx.undefined())
/// }
/// ```
#[cfg_attr(docsrs, doc(cfg(feature = "napi-4")))]
pub struct Channel {
    state: Arc<ChannelState>,
    has_ref: bool,
}

impl fmt::Debug for Channel {
    fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
        f.write_str("Channel")
    }
}

impl Channel {
    /// Creates an unbounded channel for scheduling closures on the JavaScript
    /// main thread
    pub fn new<'a, C: Context<'a>>(cx: &mut C) -> Self {
        Self {
            state: Arc::new(ChannelState::new(cx)),
            has_ref: true,
        }
    }

    /// Allow the Node event loop to exit while this `Channel` exists.
    /// _Idempotent_
    pub fn unref<'a, C: Context<'a>>(&mut self, cx: &mut C) -> &mut Self {
        // Already unreferenced
        if !self.has_ref {
            return self;
        }

        self.has_ref = false;
        self.state.unref(cx);
        self
    }

    /// Prevent the Node event loop from exiting while this `Channel` exists. (Default)
    /// _Idempotent_
    pub fn reference<'a, C: Context<'a>>(&mut self, cx: &mut C) -> &mut Self {
        // Already referenced
        if self.has_ref {
            return self;
        }

        self.has_ref = true;
        self.state.reference(cx);
        self
    }

    /// Schedules a closure to execute on the JavaScript thread that created this Channel
    /// Panics if there is a libuv error
    pub fn send<T, F>(&self, f: F) -> JoinHandle<T>
    where
        T: Send + 'static,
        F: FnOnce(Cx) -> NeonResult<T> + Send + 'static,
    {
        self.try_send(f).unwrap()
    }

    /// Schedules a closure to execute on the JavaScript thread that created this Channel
    /// Returns an `Error` if the task could not be scheduled.
    ///
    /// See [`SendError`] for additional details on failure causes.
    pub fn try_send<T, F>(&self, f: F) -> Result<JoinHandle<T>, SendError>
    where
        T: Send + 'static,
        F: FnOnce(Cx) -> NeonResult<T> + Send + 'static,
    {
        let (tx, rx) = oneshot::channel();
        let callback = Box::new(move |env| {
            let env = Env::from(env);

            // Note: It is sufficient to use `Cx` because
            // N-API creates a `HandleScope` before calling the callback.
            Cx::with_context(env, move |cx| {
                // Error can be ignored; it only means the user didn't join
                let _ = tx.send(f(cx).map_err(Into::into));
            });
        });

        self.state
            .tsfn
            .call(callback, None)
            .map_err(|_| SendError)?;

        Ok(JoinHandle { rx })
    }

    /// Returns a boolean indicating if this `Channel` will prevent the Node event
    /// loop from exiting.
    pub fn has_ref(&self) -> bool {
        self.has_ref
    }
}

impl Clone for Channel {
    /// Returns a clone of the Channel instance that shares the internal
    /// unbounded queue with the original channel. Scheduling callbacks on the
    /// same queue is faster than using separate channels, but might lead to
    /// starvation if one of the threads posts significantly more callbacks on
    /// the channel than the other one.
    ///
    /// Cloned and referenced Channel instances might trigger additional
    /// event-loop tick when dropped. Channel can be wrapped into an Arc and
    /// shared between different threads/callers to avoid this.
    fn clone(&self) -> Self {
        // Not referenced, we can simply clone the fields
        if !self.has_ref {
            return Self {
                state: self.state.clone(),
                has_ref: false,
            };
        }

        let state = Arc::clone(&self.state);

        // Only need to increase the ref count since the tsfn is already referenced
        state.ref_count.fetch_add(1, Ordering::Relaxed);

        Self {
            state,
            has_ref: true,
        }
    }
}

impl Drop for Channel {
    fn drop(&mut self) {
        // Not a referenced event queue
        if !self.has_ref {
            return;
        }

        // It was only us who kept the `ChannelState` alive. No need to unref
        // the `tsfn`, because it is going to be dropped once this function
        // returns.
        if Arc::strong_count(&self.state) == 1 {
            return;
        }

        // The ChannelState is dropped on a worker thread. We have to `unref`
        // the tsfn on the UV thread after all pending closures. Note that in
        // the most of scenarios the optimization in N-API layer would coalesce
        // `send()` with a user-supplied closure and the unref send here into a
        // single UV tick.
        //
        // If this ever has to be optimized a second `Arc` could be used to wrap
        // the `state` and it could be cloned in `try_send` and unref'ed on the
        // UV thread if strong reference count goes to 0.
        let state = Arc::clone(&self.state);

        // `Channel::try_send` will only fail if the environment has shutdown.
        // In that case, the teardown will perform clean-up.
        let _ = self.try_send(move |mut cx| {
            state.unref(&mut cx);
            Ok(())
        });
    }
}

/// An owned permission to join on the result of a closure sent to the JavaScript main
/// thread with [`Channel::send`].
pub struct JoinHandle<T> {
    // `Err` is always `Throw`, but `Throw` cannot be sent across threads
    rx: oneshot::Receiver<Result<T, SendThrow>>,
}

impl<T> JoinHandle<T> {
    /// Waits for the associated closure to finish executing
    ///
    /// If the closure panics or throws an exception, `Err` is returned
    ///
    /// # Panics
    ///
    /// This function panics if called within an asynchronous execution context.
    pub fn join(self) -> Result<T, JoinError> {
        Ok(self.rx.blocking_recv()??)
    }
}

#[cfg(feature = "futures")]
#[cfg_attr(docsrs, doc(cfg(feature = "futures")))]
impl<T> Future for JoinHandle<T> {
    type Output = Result<T, JoinError>;

    fn poll(mut self: Pin<&mut Self>, cx: &mut task::Context) -> Poll<Self::Output> {
        match Pin::new(&mut self.rx).poll(cx) {
            Poll::Ready(result) => {
                // Flatten `Result<Result<T, SendThrow>, RecvError>` by mapping to
                // `Result<T, JoinError>`. This can be simplified by replacing the
                // closure with a try-block after stabilization.
                // https://doc.rust-lang.org/beta/unstable-book/language-features/try-blocks.html
                let get_result = move || Ok(result??);

                Poll::Ready(get_result())
            }
            Poll::Pending => Poll::Pending,
        }
    }
}

#[derive(Debug)]
/// Error returned by [`JoinHandle::join`] indicating the associated closure panicked
/// or threw an exception.
pub struct JoinError(JoinErrorType);

#[derive(Debug)]
enum JoinErrorType {
    Panic,
    Throw,
}

impl JoinError {
    fn as_str(&self) -> &str {
        match &self.0 {
            JoinErrorType::Panic => "Closure panicked before returning",
            JoinErrorType::Throw => "Closure threw an exception",
        }
    }
}

impl fmt::Display for JoinError {
    fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
        f.write_str(self.as_str())
    }
}

impl error::Error for JoinError {}

impl From<oneshot::error::RecvError> for JoinError {
    fn from(_: oneshot::error::RecvError) -> Self {
        JoinError(JoinErrorType::Panic)
    }
}

// Marker that a `Throw` occurred that can be sent across threads for use in `JoinError`
pub(crate) struct SendThrow(());

impl From<SendThrow> for JoinError {
    fn from(_: SendThrow) -> Self {
        JoinError(JoinErrorType::Throw)
    }
}

impl From<Throw> for SendThrow {
    fn from(_: Throw) -> SendThrow {
        SendThrow(())
    }
}

impl<T> ResultExt<T> for Result<T, JoinError> {
    fn or_throw<'a, C: Context<'a>>(self, cx: &mut C) -> NeonResult<T> {
        self.or_else(|err| cx.throw_error(err.as_str()))
    }
}

/// Error indicating that a closure was unable to be scheduled to execute on the event loop.
///
/// The most likely cause of a failure is that Node is shutting down. This may occur if the
/// process is forcefully exiting even if the channel is referenced. For example, by calling
/// `process.exit()`.
//
// NOTE: These docs will need to be updated to include `QueueFull` if bounded queues are
// implemented.
#[cfg_attr(docsrs, doc(cfg(feature = "napi-4")))]
pub struct SendError;

impl fmt::Display for SendError {
    fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
        write!(f, "SendError")
    }
}

impl fmt::Debug for SendError {
    fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
        fmt::Display::fmt(self, f)
    }
}

impl error::Error for SendError {}

struct ChannelState {
    tsfn: ThreadsafeFunction<Callback>,
    ref_count: AtomicUsize,
}

impl ChannelState {
    fn new<'a, C: Context<'a>>(cx: &mut C) -> Self {
        let tsfn = unsafe { ThreadsafeFunction::new(cx.env().to_raw(), Self::callback) };
        Self {
            tsfn,
            ref_count: AtomicUsize::new(1),
        }
    }

    fn reference<'a, C: Context<'a>>(&self, cx: &mut C) {
        // We can use relaxed ordering because `reference()` can only be called
        // on the Event-Loop thread.
        if self.ref_count.fetch_add(1, Ordering::Relaxed) != 0 {
            return;
        }

        unsafe {
            self.tsfn.reference(cx.env().to_raw());
        }
    }

    fn unref<'a, C: Context<'a>>(&self, cx: &mut C) {
        // We can use relaxed ordering because `unref()` can only be called
        // on the Event-Loop thread.
        if self.ref_count.fetch_sub(1, Ordering::Relaxed) != 1 {
            return;
        }

        unsafe {
            self.tsfn.unref(cx.env().to_raw());
        }
    }

    // Monomorphized trampoline funciton for calling the user provided closure
    fn callback(env: Option<sys::Env>, callback: Callback) {
        if let Some(env) = env {
            callback(env);
        } else {
            crate::context::internal::IS_RUNNING.with(|v| {
                *v.borrow_mut() = false;
            });
        }
    }
}


================================================
FILE: crates/neon/src/event/mod.rs
================================================
//! Exposes the JavaScript event loop for scheduling asynchronous events.
//!
//! ## The Event Loop
//!
//! The [_event loop_][event-loop] is how Node.js provides JavaScript programs
//! access to concurrent events such as completion of [file][fs] or
//! [network][net] operations, notification of scheduled [timers][timer], or
//! receiving of messages from other [processes][process].
//!
//! When an asynchronous operation is started from JavaScript, it registers
//! a JavaScript callback function to wait for the operation to complete. When
//! the operation completes, the callback and the result data are added to an
//! internal _event queue_ in the Node.js runtime so that the event can be
//! processed in order.
//!
//! The event loop processes completed events one at a time in the JavaScript
//! execution thread by calling the registered callback function with its result
//! value as an argument.
//!
//! ## Creating Custom Events
//!
//! This module allows Neon programs to create new types of concurrent events
//! in Rust and expose them to JavaScript as asynchronous functions.
//!
//! A common use for custom events is to run expensive or long-lived
//! computations in a background thread without blocking the JavaScript
//! thread. For example, using the [`psd` crate][psd-crate], a Neon program could
//! asynchronously parse (potentially large) [PSD files][psd-file] in a
//! background thread:
//!
//! ```
//! # use neon::prelude::*;
//! # #[cfg(not(feature = "napi-6"))]
//! # type Channel = ();
//! # fn parse(filename: String, callback: Root<JsFunction>, channel: Channel) { }
//! # #[cfg(feature = "napi-6")]
//! fn parse_async(mut cx: FunctionContext) -> JsResult<JsUndefined> {
//!     // The types `String`, `Root<JsFunction>`, and `Channel` can all be
//!     // sent across threads.
//!     let filename = cx.argument::<JsString>(0)?.value(&mut cx);
//!     let callback = cx.argument::<JsFunction>(1)?.root(&mut cx);
//!     let channel = cx.channel();
//!
//!     // Spawn a background thread to complete the execution. The background
//!     // execution will _not_ block the JavaScript event loop.
//!     std::thread::spawn(move || {
//!         // Do the heavy lifting inside the background thread.
//!         parse(filename, callback, channel);
//!     });
//!
//!     Ok(cx.undefined())
//! }
//! ```
//!
//! (Note that this usage of [`spawn`](std::thread::spawn) makes use of Rust's
//! [`move`][move] syntax to transfer ownership of data to the background
//! thread.)
//!
//! Upon completion of its task, the background thread can use the JavaScript
//! callback and the channel to notify the main thread of the result:
//!
//! ```
//! # use neon::prelude::*;
//! # #[cfg(not(feature = "napi-6"))]
//! # type Channel = ();
//! # use psd::Psd;
//! # use anyhow::{Context as _, Result};
//! #
//! fn psd_from_filename(filename: String) -> Result<Psd> {
//!     Psd::from_bytes(&std::fs::read(&filename)?).context("invalid psd file")
//! }
//!
//! # #[cfg(feature = "napi-6")]
//! fn parse(filename: String, callback: Root<JsFunction>, channel: Channel) {
//!     let result = psd_from_filename(filename);
//!
//!     // Send a closure as a task to be executed by the JavaScript event
//!     // loop. This _will_ block the event loop while executing.
//!     channel.send(move |mut cx| {
//!         let callback = callback.into_inner(&mut cx);
//!
//!         match result {
//!             Ok(psd) => {
//!                 // Extract data from the parsed file.
//!                 let obj = cx.empty_object()
//!                     .prop(&mut cx, "width").set(psd.width())?
//!                     .prop("height").set(psd.height())?
//!                     .this();
//!
//!                 callback
//!                     .bind(&mut cx)
//!                     .args(((), obj))?
//!                     .exec()?;
//!             }
//!             Err(err) => {
//!                 use neon::types::extract::Error;
//!                 callback
//!                     .bind(&mut cx)
//!                     .arg(Error::from(err))?
//!                     .exec()?;
//!             }
//!         }
//!
//!         Ok(())
//!     });
//! }
//! ```
//!
//! ## See also
//!
//! 1. Panu Pitkamaki. [Event loop from 10,000ft][event-loop].
//!
//! [event-loop]: https://bytearcher.com/articles/event-loop-10-000ft/
//! [fs]: https://nodejs.org/dist/latest/docs/api/fs.html
//! [net]: https://nodejs.org/dist/latest/docs/api/net.html
//! [process]: https://nodejs.org/dist/latest/docs/api/process.html
//! [timer]: https://nodejs.org/dist/latest/docs/api/timers.html
//! [move]: https://doc.rust-lang.org/std/keyword.move.html
//! [psd-crate]: https://crates.io/crates/psd
//! [psd-file]: https://www.adobe.com/devnet-apps/photoshop/fileformatashtml/

#[cfg(feature = "napi-4")]
mod channel;

mod task;

pub use self::task::TaskBuilder;

#[cfg(all(feature = "napi-5", feature = "futures"))]
pub(crate) use self::channel::SendThrow;
#[cfg(feature = "napi-4")]
pub use self::channel::{Channel, JoinError, JoinHandle, SendError};

#[cfg(feature = "napi-4")]
#[deprecated(since = "0.9.0", note = "Please use the Channel type instead")]
#[doc(hidden)]
pub type EventQueue = self::channel::Channel;

#[cfg(feature = "napi-4")]
#[deprecated(since = "0.9.0", note = "Please use the SendError type instead")]
#[doc(hidden)]
pub type EventQueueError = self::channel::SendError;


================================================
FILE: crates/neon/src/event/task.rs
================================================
use std::{panic::resume_unwind, thread};

use crate::{
    context::{internal::Env, Context, Cx},
    handle::Handle,
    result::{JsResult, NeonResult},
    sys::{async_work, raw},
    types::{Deferred, JsPromise, Value},
};

/// Node asynchronous task builder
///
/// ```
/// # use neon::prelude::*;
/// fn greet(mut cx: FunctionContext) -> JsResult<JsPromise> {
///     let name = cx.argument::<JsString>(0)?.value(&mut cx);
///
///     let promise = cx
///         .task(move || format!("Hello, {}!", name))
///         .promise(move |mut cx, greeting| Ok(cx.string(greeting)));
///
///     Ok(promise)
/// }
/// ```
pub struct TaskBuilder<'cx, C, E> {
    cx: &'cx mut C,
    execute: E,
}

impl<'a: 'cx, 'cx, C, O, E> TaskBuilder<'cx, C, E>
where
    C: Context<'a>,
    O: Send + 'static,
    E: FnOnce() -> O + Send + 'static,
{
    /// Construct a new task builder from an `execute` callback that can be
    /// scheduled to execute on the Node worker pool
    pub fn new(cx: &'cx mut C, execute: E) -> Self {
        Self { cx, execute }
    }

    /// Schedules a task to execute on the Node worker pool, executing the
    /// `complete` callback on the JavaScript main thread with the result
    /// of the `execute` callback
    pub fn and_then<F>(self, complete: F)
    where
        F: FnOnce(Cx, O) -> NeonResult<()> + 'static,
    {
        let env = self.cx.env();
        let execute = self.execute;

        schedule(env, execute, complete);
    }

    /// Schedules a task to execute on the Node worker pool and returns a
    /// promise that is resolved with the value from the `complete` callback.
    ///
    /// The `complete` callback will execute on the JavaScript main thread and
    /// is passed the return value from `execute`. If the `complete` callback
    /// throws, the promise will be rejected with the exception
    pub fn promise<V, F>(self, complete: F) -> Handle<'a, JsPromise>
    where
        V: Value,
        F: FnOnce(Cx, O) -> JsResult<V> + 'static,
    {
        let env = self.cx.env();
        let (deferred, promise) = JsPromise::new(self.cx);
        let execute = self.execute;

        schedule_promise(env, execute, complete, deferred);

        promise
    }
}

// Schedule a task to execute on the Node worker pool
fn schedule<I, O, D>(env: Env, input: I, data: D)
where
    I: FnOnce() -> O + Send + 'static,
    O: Send + 'static,
    D: FnOnce(Cx, O) -> NeonResult<()> + 'static,
{
    unsafe {
        async_work::schedule(env.to_raw(), input, execute::<I, O>, complete::<O, D>, data);
    }
}

fn execute<I, O>(input: I) -> O
where
    I: FnOnce() -> O + Send + 'static,
    O: Send + 'static,
{
    input()
}

fn complete<O, D>(env: raw::Env, output: thread::Result<O>, callback: D)
where
    O: Send + 'static,
    D: FnOnce(Cx, O) -> NeonResult<()> + 'static,
{
    let output = output.unwrap_or_else(|panic| {
        // If a panic was caught while executing the task on the Node Worker
        // pool, resume panicking on the main JavaScript thread
        resume_unwind(panic)
    });

    Cx::with_context(env.into(), move |cx| {
        let _ = callback(cx, output);
    });
}

// Schedule a task to execute on the Node worker pool and settle a `Promise` with the result
fn schedule_promise<I, O, D, V>(env: Env, input: I, complete: D, deferred: Deferred)
where
    I: FnOnce() -> O + Send + 'static,
    O: Send + 'static,
    D: FnOnce(Cx, O) -> JsResult<V> + 'static,
    V: Value,
{
    unsafe {
        async_work::schedule(
            env.to_raw(),
            input,
            execute::<I, O>,
            complete_promise::<O, D, V>,
            (complete, deferred),
        );
    }
}

fn complete_promise<O, D, V>(
    env: raw::Env,
    output: thread::Result<O>,
    (complete, deferred): (D, Deferred),
) where
    O: Send + 'static,
    D: FnOnce(Cx, O) -> JsResult<V> + 'static,
    V: Value,
{
    let env = env.into();

    Cx::with_context(env, move |cx| {
        deferred.try_catch_settle(cx, move |cx| {
            let output = output.unwrap_or_else(|panic| resume_unwind(panic));

            complete(cx, output)
        })
    });
}


================================================
FILE: crates/neon/src/executor/mod.rs
================================================
use std::{future::Future, pin::Pin};

use crate::{context::Cx, thread::LocalKey};

#[cfg(feature = "tokio-rt")]
pub(crate) mod tokio;

type BoxFuture = Pin<Box<dyn Future<Output = ()> + Send + 'static>>;

pub(crate) static RUNTIME: LocalKey<Box<dyn Runtime>> = LocalKey::new();

pub trait Runtime: Send + Sync + 'static {
    fn spawn(&self, fut: BoxFuture);
}

/// Register a [`Future`] executor runtime globally to the addon.
///
/// Returns `Ok(())` if a global executor has not been set and `Err(runtime)` if it has.
///
/// If the `tokio` feature flag is enabled and the addon does not provide a
/// [`#[neon::main]`](crate::main) function, a multithreaded tokio runtime will be
/// automatically registered.
///
/// **Note**: Each instance of the addon will have its own runtime. It is recommended
/// to initialize the async runtime once in a process global and share it across instances.
///
/// ```
/// # fn main() {
/// # #[cfg(feature = "tokio-rt-multi-thread")]
/// # fn example() {
/// # use neon::prelude::*;
/// use once_cell::sync::OnceCell;
/// use tokio::runtime::Runtime;
///
/// static RUNTIME: OnceCell<Runtime> = OnceCell::new();
///
/// #[neon::main]
/// fn main(mut cx: ModuleContext) -> NeonResult<()> {
///     let runtime = RUNTIME
///         .get_or_try_init(Runtime::new)
///         .or_else(|err| cx.throw_error(err.to_string()))?;
///
///     let _ = neon::set_global_executor(&mut cx, runtime);
///
///     Ok(())
/// }
/// # }
/// # }
/// ```
pub fn set_global_executor<R>(cx: &mut Cx, runtime: R) -> Result<(), R>
where
    R: Runtime,
{
    if RUNTIME.get(cx).is_some() {
        return Err(runtime);
    }

    RUNTIME.get_or_init(cx, || Box::new(runtime));

    Ok(())
}


================================================
FILE: crates/neon/src/executor/tokio.rs
================================================
use std::sync::Arc;

use super::{BoxFuture, Runtime};

impl Runtime for tokio::runtime::Runtime {
    fn spawn(&self, fut: BoxFuture) {
        spawn(self.handle(), fut);
    }
}

impl Runtime for Arc<tokio::runtime::Runtime> {
    fn spawn(&self, fut: BoxFuture) {
        spawn(self.handle(), fut);
    }
}

impl Runtime for &'static tokio::runtime::Runtime {
    fn spawn(&self, fut: BoxFuture) {
        spawn(self.handle(), fut);
    }
}

impl Runtime for tokio::runtime::Handle {
    fn spawn(&self, fut: BoxFuture) {
        spawn(self, fut);
    }
}

impl Runtime for &'static tokio::runtime::Handle {
    fn spawn(&self, fut: BoxFuture) {
        spawn(self, fut);
    }
}

fn spawn(handle: &tokio::runtime::Handle, fut: BoxFuture) {
    #[allow(clippy::let_underscore_future)]
    let _ = handle.spawn(fut);
}

#[cfg(feature = "tokio-rt-multi-thread")]
pub(crate) fn init(cx: &mut crate::context::ModuleContext) -> crate::result::NeonResult<()> {
    use once_cell::sync::OnceCell;
    use tokio::runtime::{Builder, Runtime};

    use crate::context::Context;

    static RUNTIME: OnceCell<Runtime> = OnceCell::new();

    super::RUNTIME.get_or_try_init(cx, |cx| {
        let runtime = RUNTIME
            .get_or_try_init(|| {
                #[cfg(feature = "tokio-rt-multi-thread")]
                let mut builder = Builder::new_multi_thread();

                #[cfg(not(feature = "tokio-rt-multi-thread"))]
                let mut builder = Builder::new_current_thread();

                builder.enable_all().build()
            })
            .or_else(|err| cx.throw_error(err.to_string()))?;

        Ok(Box::new(runtime))
    })?;

    Ok(())
}


================================================
FILE: crates/neon/src/handle/internal.rs
================================================
use std::{fmt::Debug, mem};

use crate::types::Value;

pub trait SuperType<T: Value> {
    fn upcast_internal(v: &T) -> Self;
}

#[doc(hidden)]
/// Trait asserting that `Self` is a transparent wrapper around `Self::Inner`
/// with identical representation and may be safely transmuted.
///
/// # Safety
/// `Self` must be `#[repr(transparent)]` with a field `Self::Inner`
pub unsafe trait TransparentNoCopyWrapper: Sized {
    type Inner: Debug + Copy;

    // A default implementation cannot be provided because it would create
    // dependently sized types. This may be supported in a future Rust version.
    fn into_inner(self) -> Self::Inner;

    fn wrap_ref(s: &Self::Inner) -> &Self {
        unsafe { mem::transmute(s) }
    }

    fn wrap_mut(s: &mut Self::Inner) -> &mut Self {
        unsafe { mem::transmute(s) }
    }
}


================================================
FILE: crates/neon/src/handle/mod.rs
================================================
//! References to garbage-collected JavaScript values.
//!
//! A _handle_ is a safe reference to a JavaScript value that is owned and managed
//! by the JavaScript engine's memory management system (the garbage collector).
//!
//! Neon APIs that accept and return JavaScript values never use raw pointer types
//! ([`*T`](pointer)) or reference types ([`&T`](reference)). Instead they use the
//! special Neon type [`Handle`], which encapsulates a JavaScript
//! [`Value`] and ensures that Rust only maintains access to
//! the value while it is guaranteed to be valid.
//!
//! ## Working with Handles
//!
//! The `Handle<T>` type automatically dereferences to `T` (via the standard
//! [`Deref`] trait), so you can call `T`'s methods on a value of
//! type `Handle<T>`. For example, we can call
//! [`JsNumber::value()`](crate::types::JsNumber::value) on a `Handle<JsNumber>`:
//!
//! ```
//! # use neon::prelude::*;
//! # fn run(mut cx: FunctionContext) -> JsResult<JsUndefined> {
//! let n: Handle<JsNumber> = cx.argument(0)?;
//! let v = n.value(&mut cx); // JsNumber::value()
//! # Ok(cx.undefined())
//! # }
//! ```
//!
//! ## Example
//!
//! This Neon function takes an object as its argument, extracts an object property,
//! `homeAddress`, and then extracts a string property, `zipCode` from that second
//! object. Each JavaScript value in the calculation is stored locally in a `Handle`.
//!
//! ```
//! # use neon::prelude::*;
//! # use neon::export;
//! #[export]
//! fn customer_zip_code<'cx>(cx: &mut FunctionContext<'cx>, customer: Handle<'cx, JsObject>) -> JsResult<'cx, JsString> {
//!     let home_address: Handle<JsObject> = customer.prop(cx, "homeAddress").get()?;
//!     let zip_code: Handle<JsString> = home_address.prop(cx, "zipCode").get()?;
//!     Ok(zip_code)
//! }
//! ```

pub(crate) mod internal;

pub(crate) mod root;

use std::{
    error::Error,
    fmt::{self, Debug, Display},
    marker::PhantomData,
    mem,
    ops::{Deref, DerefMut},
};

pub use self::root::Root;

use crate::{
    context::Context,
    handle::internal::{SuperType, TransparentNoCopyWrapper},
    result::{JsResult, ResultExt},
    sys,
    types::Value,
};

/// A handle to a JavaScript value that is owned by the JavaScript engine.
#[derive(Debug)]
#[repr(transparent)]
pub struct Handle<'a, V: Value + 'a> {
    // Contains the actual `Copy` JavaScript value data. It will be wrapped in
    // in a `!Copy` type when dereferencing. Only `V` should be visible to the user.
    value: <V as TransparentNoCopyWrapper>::Inner,
    phantom: PhantomData<&'a V>,
}

impl<'a, V: Value> Clone for Handle<'a, V> {
    fn clone(&self) -> Self {
        *self
    }
}

impl<'a, V: Value> Copy for Handle<'a, V> {}

impl<'a, V: Value + 'a> Handle<'a, V> {
    pub(crate) fn new_internal(value: V) -> Handle<'a, V> {
        Handle {
            value: value.into_inner(),
            phantom: PhantomData,
        }
    }
}

/// An error representing a failed downcast.
#[derive(PartialEq, Eq, PartialOrd, Ord, Clone)]
pub struct DowncastError<F: Value, T: Value> {
    phantom_from: PhantomData<F>,
    phantom_to: PhantomData<T>,
}

impl<F: Value, T: Value> Debug for DowncastError<F, T> {
    fn fmt(&self, f: &mut fmt::Formatter) -> Result<(), fmt::Error> {
        write!(f, "DowncastError")
    }
}

impl<F: Value, T: Value> DowncastError<F, T> {
    fn new() -> Self {
        DowncastError {
            phantom_from: PhantomData,
            phantom_to: PhantomData,
        }
    }
}

impl<F: Value, T: Value> Display for DowncastError<F, T> {
    fn fmt(&self, f: &mut fmt::Formatter) -> Result<(), fmt::Error> {
        write!(f, "failed to downcast {} to {}", F::name(), T::name())
    }
}

impl<F: Value, T: Value> Error for DowncastError<F, T> {}

/// The result of a call to [`Handle::downcast()`](Handle::downcast).
pub type DowncastResult<'a, F, T> = Result<Handle<'a, T>, DowncastError<F, T>>;

impl<'a, F: Value, T: Value> ResultExt<Handle<'a, T>> for DowncastResult<'a, F, T> {
    fn or_throw<'b, C: Context<'b>>(self, cx: &mut C) -> JsResult<'a, T> {
        match self {
            Ok(v) => Ok(v),
            Err(e) => cx.throw_type_error(e.to_string()),
        }
    }
}

impl<'a, T: Value> Handle<'a, T> {
    /// Safely upcast a handle to a supertype.
    ///
    /// This method does not require an execution context because it only copies a handle.
    pub fn upcast<U: Value + SuperType<T>>(&self) -> Handle<'a, U> {
        Handle::new_internal(SuperType::upcast_internal(self.deref()))
    }

    /// Tests whether this value is an instance of the given type.
    ///
    /// # Example:
    ///
    /// ```no_run
    /// # use neon::prelude::*;
    /// # fn my_neon_function(mut cx: FunctionContext) -> JsResult<JsUndefined> {
    /// let v: Handle<JsValue> = cx.number(17).upcast();
    /// v.is_a::<JsString, _>(&mut cx); // false
    /// v.is_a::<JsNumber, _>(&mut cx); // true
    /// v.is_a::<JsValue, _>(&mut cx);  // true
    /// # Ok(cx.undefined())
    /// # }
    /// ```
    pub fn is_a<'b, U: Value, C: Context<'b>>(&self, cx: &mut C) -> bool {
        U::is_typeof(cx.cx_mut(), self.deref())
    }

    /// Attempts to downcast a handle to another type, which may fail. A failure
    /// to downcast **does not** throw a JavaScript exception, so it's OK to
    /// continue interacting with the JS engine if this method produces an `Err`
    /// result.
    pub fn downcast<'b, U: Value, C: Context<'b>>(&self, cx: &mut C) -> DowncastResult<'a, T, U> {
        match U::downcast(cx.cx_mut(), self.deref()) {
            Some(v) => Ok(Handle::new_internal(v)),
            None => Err(DowncastError::new()),
        }
    }

    /// Attempts to downcast a handle to another type, raising a JavaScript `TypeError`
    /// exception on failure. This method is a convenient shorthand, equivalent to
    /// `self.downcast::<U>().or_throw::<C>(cx)`.
    pub fn downcast_or_throw<'b, U: Value, C: Context<'b>>(&self, cx: &mut C) -> JsResult<'a, U> {
        self.downcast(cx).or_throw(cx)
    }

    pub fn strict_equals<'b, U: Value, C: Context<'b>>(
        &self,
        cx: &mut C,
        other: Handle<'b, U>,
    ) -> bool {
        unsafe { sys::mem::strict_equals(cx.env().to_raw(), self.to_local(), other.to_local()) }
    }
}

impl<'a, V: Value> Deref for Handle<'a, V> {
    type Target = V;
    fn deref(&self) -> &V {
        unsafe { mem::transmute(&self.value) }
    }
}

impl<'a, V: Value> DerefMut for Handle<'a, V> {
    fn deref_mut(&mut self) -> &mut V {
        unsafe { mem::transmute(&mut self.value) }
    }
}


================================================
FILE: crates/neon/src/handle/root.rs
================================================
use std::{ffi::c_void, marker::PhantomData};

use crate::{
    context::Context,
    handle::Handle,
    object::Object,
    sys::{raw, reference},
    types::boxed::Finalize,
};

#[cfg(feature = "napi-6")]
use {
    crate::{
        lifecycle::{DropData, InstanceData, InstanceId},
        sys::tsfn::ThreadsafeFunction,
    },
    std::sync::Arc,
};

#[cfg(not(feature = "napi-6"))]
use std::thread::{self, ThreadId};

#[cfg(not(feature = "napi-6"))]
type InstanceId = ThreadId;

#[repr(transparent)]
#[derive(Clone)]
pub(crate) struct NapiRef(*mut c_void);

impl NapiRef {
    /// # Safety
    /// Must only be used from the same module context that created the reference
    pub(crate) unsafe fn unref(self, env: raw::Env) {
        reference::unreference(env, self.0.cast());
    }
}

// # Safety
// `NapiRef` are reference counted types that allow references to JavaScript objects
// to outlive a `Context` (`napi_env`). Since access is serialized by obtaining a
// `Context`, they are both `Send` and `Sync`.
// https://nodejs.org/api/n-api.html#n_api_references_to_objects_with_a_lifespan_longer_than_that_of_the_native_method
unsafe impl Send for NapiRef {}

unsafe impl Sync for NapiRef {}

/// A thread-safe handle that holds a reference to a JavaScript object and
/// prevents it from being garbage collected.
///
/// A `Root<T>` may be sent across threads, but the referenced object may
/// only be accessed on the JavaScript thread that created it.
pub struct Root<T> {
    // `Option` is used to skip `Drop` when `Root::drop` or `Root::into_inner` is used.
    // It will *always* be `Some` when a user is interacting with `Root`.
    internal: Option<NapiRef>,
    instance_id: InstanceId,
    #[cfg(feature = "napi-6")]
    drop_queue: Arc<ThreadsafeFunction<DropData>>,
    _phantom: PhantomData<T>,
}

impl<T> std::fmt::Debug for Root<T> {
    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
        write!(f, "Root<{}>", std::any::type_name::<T>())
    }
}

// `Root` are intended to be `Send` and `Sync`
// Safety: `Root` contains two types. A `NapiRef` which is `Send` and `Sync` and a
// `PhantomData` that does not impact the safety.
unsafe impl<T> Send for Root<T> {}

unsafe impl<T> Sync for Root<T> {}

#[cfg(feature = "napi-6")]
fn instance_id<'a, C: Context<'a>>(cx: &mut C) -> InstanceId {
    InstanceData::id(cx)
}

#[cfg(not(feature = "napi-6"))]
fn instance_id<'a, C: Context<'a>>(_: &mut C) -> InstanceId {
    thread::current().id()
}

impl<T: Object> Root<T> {
    /// Create a reference to a JavaScript object. The object will not be
    /// garbage collected until the `Root` is dropped. A `Root<T>` may only
    /// be dropped on the JavaScript thread that created it.
    ///
    /// The caller _should_ ensure `Root::into_inner` or `Root::drop` is called
    /// to properly dispose of the `Root<T>`. If the value is dropped without
    /// calling one of these methods:
    /// * N-API < 6, Neon will `panic` to notify of the leak
    /// * N-API >= 6, Neon will drop from a global queue at a runtime cost
    pub fn new<'a, C: Context<'a>>(cx: &mut C, value: &T) -> Self {
        let env = cx.env().to_raw();
        let internal = unsafe { reference::new(env, value.to_local()) };

        Self {
            internal: Some(NapiRef(internal as *mut _)),
            instance_id: instance_id(cx),
            #[cfg(feature = "napi-6")]
            drop_queue: InstanceData::drop_queue(cx),
            _phantom: PhantomData,
        }
    }

    /// Clone a reference to the contained JavaScript object. This method can
    /// be considered identical to the following:
    /// ```
    /// # use neon::prelude::*;
    /// # fn my_neon_function(mut cx: FunctionContext) -> JsResult<JsUndefined> {
    /// # let root = cx.argument::<JsObject>(0)?.root(&mut cx);
    /// let inner = root.into_inner(&mut cx);
    /// let cloned = inner.root(&mut cx);
    /// let root = inner.root(&mut cx);
    /// # Ok(cx.undefined())
    /// # }
    /// ```
    pub fn clone<'a, C: Context<'a>>(&self, cx: &mut C) -> Self {
        let env = cx.env();
        let internal = self.as_napi_ref(cx).0 as *mut _;

        unsafe {
            reference::reference(env.to_raw(), internal);
        };

        Self {
            internal: self.internal.clone(),
            instance_id: instance_id(cx),
            #[cfg(feature = "napi-6")]
            drop_queue: Arc::clone(&self.drop_queue),
            _phantom: PhantomData,
        }
    }

    /// Safely drop a `Root<T>` without returning the referenced JavaScript
    /// object.
    pub fn drop<'a, C: Context<'a>>(self, cx: &mut C) {
        let env = cx.env().to_raw();

        unsafe {
            self.into_napi_ref(cx).unref(env);
        }
    }

    /// Return the referenced JavaScript object and allow it to be garbage collected.
    ///
    /// # Panics
    ///
    /// This method panics if it is called from a different JavaScript thread than the
    /// one in which the handle was created.
    pub fn into_inner<'a, C: Context<'a>>(self, cx: &mut C) -> Handle<'a, T> {
        let env = cx.env();
        let internal = self.into_napi_ref(cx);
        let local = unsafe { reference::get(env.to_raw(), internal.0.cast()) };

        unsafe {
            internal.unref(env.to_raw());
        }

        Handle::new_internal(unsafe { T::from_local(env, local) })
    }

    /// Access the inner JavaScript object without consuming the `Root`
    /// This method aliases the reference without changing the reference count. It
    /// can be used in place of a clone immediately followed by a call to `into_inner`.
    ///
    /// # Panics
    ///
    /// This method panics if it is called from a different JavaScript thread than the
    /// one in which the handle was created.
    pub fn to_inner<'a, C: Context<'a>>(&self, cx: &mut C) -> Handle<'a, T> {
        let env = cx.env();
        let local = unsafe { reference::get(env.to_raw(), self.as_napi_ref(cx).0 as *mut _) };

        Handle::new_internal(unsafe { T::from_local(env, local) })
    }

    fn as_napi_ref<'a, C: Context<'a>>(&self, cx: &mut C) -> &NapiRef {
        if self.instance_id != instance_id(cx) {
            panic!("Attempted to dereference a `neon::handle::Root` from the wrong module ");
        }

        self.internal
            .as_ref()
            // `unwrap` will not `panic` because `internal` will always be `Some`
            // until the `Root` is consumed.
            .unwrap()
    }

    fn into_napi_ref<'a, C: Context<'a>>(mut self, cx: &mut C) -> NapiRef {
        let reference = self.as_napi_ref(cx).clone();
        // This uses `as_napi_ref` instead of `Option::take` for the instance id safety check
        self.internal = None;
        reference
    }
}

// Allows putting `Root<T>` directly in a container that implements `Finalize`
// For example, `Vec<Root<T>>` or `JsBox`.
impl<T: Object> Finalize for Root<T> {
    fn finalize<'a, C: Context<'a>>(self, cx: &mut C) {
        self.drop(cx);
    }
}

impl<T> Drop for Root<T> {
    #[cfg(not(feature = "napi-6"))]
    fn drop(&mut self) {
        // If `None`, the `NapiRef` has already been manually dropped
        if self.internal.is_none() {
            return;
        }

        // Destructors are called during stack unwinding, prevent a double
        // panic and instead prefer to leak.
        if std::thread::panicking() {
            eprintln!("Warning: neon::handle::Root leaked during a panic");
            return;
        }

        // Only panic if the event loop is still running
        if let Ok(true) = crate::context::internal::IS_RUNNING.try_with(|v| *v.borrow()) {
            panic!("Must call `into_inner` or `drop` on `neon::handle::Root`");
        }
    }

    #[cfg(feature = "napi-6")]
    fn drop(&mut self) {
        // If `None`, the `NapiRef` has already been manually dropped
        if let Some(internal) = self.internal.take() {
            let _ = self.drop_queue.call(DropData::Ref(internal), None);
        }
    }
}


================================================
FILE: crates/neon/src/lib.rs
================================================
//! The [Neon][neon] crate provides bindings for writing [Node.js addons][addons]
//! (i.e., dynamically-loaded binary modules) with a safe and fast Rust API.
//!
//! ## Getting Started
//!
//! You can conveniently bootstrap a new Neon project with the Neon project
//! generator. You don't need to install anything special on your machine as
//! long as you have a [supported version of Node and Rust][supported] on
//! your system.
//!
//! To start a new project, open a terminal in the directory where you would
//! like to place the project, and run at the command prompt:
//!
//! ```text
//! % npm init neon my-project
//! ... answer the user prompts ...
//! ✨ Created Neon project `my-project`. Happy 🦀 hacking! ✨
//! ```
//!
//! where `my-project` can be any name you like for the project. This will
//! run the Neon project generator, prompting you with a few questions and
//! placing a simple but working Neon project in a subdirectory called
//! `my-project` (or whatever name you chose).
//!
//! You can then install and build the project by changing into the project
//! directory and running the standard Node installation command:
//!
//! ```text
//! % cd my-project
//! % npm install
//! % node
//! > require(".").hello()
//! 'hello node'
//! ```
//!
//! You can look in the project's generated `README.md` for more details on
//! the project structure.
//!
//! ## Example
//!
//! The generated `src/lib.rs` contains a function annotated with the
//! [`#[neon::main]`](main) attribute, marking it as the module's main entry
//! point to be executed when the module is loaded. This function can have
//! any name but is conventionally called `main`:
//!
//! ```no_run
//! # mod example {
//! # use neon::prelude::*;
//! # fn hello(mut cx: FunctionContext) -> JsResult<JsString> {
//! #    Ok(cx.string("hello node"))
//! # }
//! #[neon::main]
//! fn main(mut cx: ModuleContext) -> NeonResult<()> {
//!     cx.export_function("hello", hello)?;
//!     Ok(())
//! }
//! # }
//! ```
//!
//! The example code generated by `npm init neon` exports a single
//! function via [`ModuleContext::export_function`](context::ModuleContext::export_function).
//! The `hello` function is defined just above `main` in `src/lib.rs`:
//!
//! ```
//! # use neon::prelude::*;
//! #
//! fn hello(mut cx: FunctionContext) -> JsResult<JsString> {
//!     Ok(cx.string("hello node"))
//! }
//! ```
//!
//! The `hello` function takes a [`FunctionContext`](context::FunctionContext) and
//! returns a JavaScript string. Because all Neon functions can potentially throw a
//! JavaScript exception, the return type is wrapped in a [`JsResult`](result::JsResult).
//!
//! [neon]: https://www.neon-bindings.com/
//! [addons]: https://nodejs.org/api/addons.html
//! [supported]: https://github.com/neon-bindings/neon#platform-support
#![cfg_attr(docsrs, feature(doc_cfg))]

pub mod context;
pub mod event;
pub mod handle;
mod macros;
pub mod meta;
pub mod object;
pub mod prelude;
pub mod reflect;
pub mod result;
#[cfg(not(feature = "sys"))]
mod sys;
#[cfg_attr(docsrs, doc(cfg(feature = "napi-6")))]
#[cfg(feature = "napi-6")]
pub mod thread;
// To use the #[aquamarine] attribute on the top-level neon::types module docs, we have to
// use this hack so we can keep the module docs in a separate file.
// See: https://github.com/mersinvald/aquamarine/issues/5#issuecomment-1168816499
mod types_docs;
mod types_impl;

#[cfg(feature = "sys")]
#[cfg_attr(docsrs, doc(cfg(feature = "sys")))]
pub mod sys;

#[cfg(all(feature = "napi-6", feature = "futures"))]
#[cfg_attr(docsrs, doc(cfg(all(feature = "napi-6", feature = "futures"))))]
pub use executor::set_global_executor;
pub use types_docs::exports as types;

#[doc(hidden)]
pub mod macro_internal;

pub use crate::macros::*;

use crate::{context::ModuleContext, handle::Handle, result::NeonResult, types::JsValue};

#[cfg(feature = "napi-6")]
mod lifecycle;

#[cfg(all(feature = "napi-6", feature = "futures"))]
mod executor;

#[cfg(feature = "napi-8")]
static MODULE_TAG: once_cell::sync::Lazy<crate::sys::TypeTag> = once_cell::sync::Lazy::new(|| {
    let mut lower = [0; std::mem::size_of::<u64>()];

    // Generating a random module tag at runtime allows Neon builds to be reproducible. A few
    //  alternatives considered:
    // * Generating a random value at build time; this reduces runtime dependencies but, breaks
    //   reproducible builds
    // * A static random value; this solves the previous issues, but does not protect against ABI
    //   differences across Neon and Rust versions
    // * Calculating a variable from the environment (e.g. Rust version); this theoretically works
    //   but, is complicated and error prone. This could be a future optimization.
    getrandom::getrandom(&mut lower).expect("Failed to generate a Neon module type tag");

    // We only use 64-bits of the available 128-bits. The rest is reserved for future versioning and
    // expansion of implementation.
    let lower = u64::from_ne_bytes(lower);

    // Note: `upper` must be non-zero or `napi_check_object_type_tag` will always return false
    // https://github.com/nodejs/node/blob/5fad0b93667ffc6e4def52996b9529ac99b26319/src/js_native_api_v8.cc#L2455
    crate::sys::TypeTag { lower, upper: 1 }
});

/// Values exported with [`neon::export`](export)
pub struct Exports(());

impl Exports {
    /// Export all values exported with [`neon::export`](export)
    ///
    /// ```
    /// # fn main() {
    /// # use neon::prelude::*;
    /// #[neon::main]
    /// fn main(mut cx: ModuleContext) -> NeonResult<()> {
    ///     neon::registered().export(&mut cx)?;
    ///     Ok(())
    /// }
    /// # }
    /// ```
    ///
    /// For more control, iterate over exports.
    ///
    /// ```
    /// # fn main() {
    /// # use neon::prelude::*;
    /// #[neon::main]
    /// fn main(mut cx: ModuleContext) -> NeonResult<()> {
    ///     for create in neon::registered() {
    ///         let (name, value) = create(&mut cx)?;
    ///
    ///         cx.export_value(name, value)?;
    ///     }
    ///
    ///     Ok(())
    /// }
    /// # }
    /// ```
    pub fn export(self, cx: &mut ModuleContext) -> NeonResult<()> {
        for create in self {
            let (name, value) = create(cx)?;

            cx.export_value(name, value)?;
        }

        Ok(())
    }
}

impl IntoIterator for Exports {
    type Item = <<Self as IntoIterator>::IntoIter as IntoIterator>::Item;
    type IntoIter = std::slice::Iter<
        'static,
        for<'cx> fn(&mut ModuleContext<'cx>) -> NeonResult<(&'static str, Handle<'cx, JsValue>)>,
    >;

    fn into_iter(self) -> Self::IntoIter {
        crate::macro_internal::EXPORTS.into_iter()
    }
}

/// Access values exported with [`neon::export`](export)
pub fn registered() -> Exports {
    Exports(())
}

#[test]
fn feature_matrix() {
    use std::{env, process::Command};

    // N.B.: Only versions that are used are included in order to keep the set
    // of permutations as small as possible.
    const NODE_API_VERSIONS: &[&str] = &["napi-1", "napi-4", "napi-5", "napi-6", "napi-8"];

    const FEATURES: &[&str] = &["external-buffers", "futures", "serde", "tokio", "tokio-rt"];

    let cargo = env::var_os("CARGO").unwrap_or_else(|| "cargo".into());

    for features in itertools::Itertools::powerset(FEATURES.iter()) {
        for version in NODE_API_VERSIONS.iter().map(|f| f.to_string()) {
            let features = features.iter().fold(version, |f, s| f + "," + s);
            let status = Command::new(&cargo)
                .args(["check", "-p", "neon", "--no-default-features", "--features"])
                .arg(features)
                .spawn()
                .unwrap()
                .wait()
                .unwrap();

            assert!(status.success());
        }
    }
}


================================================
FILE: crates/neon/src/lifecycle.rs
================================================
//! # Environment life cycle APIs
//!
//! These APIs map to the life cycle of a specific "Agent" or self-contained
//! environment. If a Neon module is loaded multiple times (Web Workers, worker
//! threads), these API will be handle data associated with a specific instance.
//!
//! See the [N-API Lifecycle][npai-docs] documentation for more details.
//!
//! [napi-docs]: https://nodejs.org/api/n-api.html#n_api_environment_life_cycle_apis

use std::{
    any::Any,
    marker::PhantomData,
    sync::{
        atomic::{AtomicU32, Ordering},
        Arc,
    },
};

use crate::{
    context::Context,
    event::Channel,
    handle::root::NapiRef,
    sys::{lifecycle, raw::Env, tsfn::ThreadsafeFunction},
    types::promise::NodeApiDeferred,
};

#[derive(Copy, Clone, Debug, Eq, PartialEq)]
#[repr(transparent)]
/// Uniquely identifies an instance of the module
///
/// _Note_: Since `InstanceData` is created lazily, the order of `id` may not
/// reflect the order that instances were created.
pub(crate) struct InstanceId(u32);

impl InstanceId {
    fn next() -> Self {
        static NEXT_ID: AtomicU32 = AtomicU32::new(0);

        let next = NEXT_ID.fetch_add(1, Ordering::SeqCst).checked_add(1);
        match next {
            Some(id) => Self(id),
            None => panic!("u32 overflow ocurred in Lifecycle InstanceId"),
        }
    }
}

/// `InstanceData` holds Neon data associated with a particular instance of a
/// native module. If a module is loaded multiple times (e.g., worker threads), this
/// data will be unique per instance.
pub(crate) struct InstanceData {
    id: InstanceId,

    /// Used to free `Root` in the same JavaScript environment that created it
    ///
    /// _Design Note_: An `Arc` ensures the `ThreadsafeFunction` outlives the unloading
    /// of a module. Since it is unlikely that modules will be re-loaded frequently, this
    /// could be replaced with a leaked `&'static ThreadsafeFunction<NapiRef>`. However,
    /// given the cost of FFI, this optimization is omitted until the cost of an
    /// `Arc` is demonstrated as significant.
    drop_queue: Arc<ThreadsafeFunction<DropData>>,

    /// Shared `Channel` that is cloned to be returned by the `cx.channel()` method
    shared_channel: Channel,

    /// Table of user-defined instance-local cells.
    locals: LocalTable,
}

#[derive(Default)]
pub(crate) struct LocalTable {
    cells: Vec<LocalCell>,
}

pub(crate) type LocalCellValue = Box<dyn Any + Send + 'static>;

#[derive(Default)]
pub(crate) enum LocalCell {
    #[default]
    /// Uninitialized state.
    Uninit,
    /// Intermediate "dirty" state representing the middle of a `get_or_try_init` transaction.
    Trying,
    /// Fully initialized state.
    Init(LocalCellValue),
}

impl LocalCell {
    /// Establish the initial state at the beginning of the initialization protocol.
    /// This method ensures that re-entrant initialization always panics (i.e. when
    /// an existing `get_or_try_init` is in progress).
    fn pre_init<F>(&mut self, f: F)
    where
        F: FnOnce() -> LocalCell,
    {
        match self {
            LocalCell::Uninit => {
                *self = f();
            }
            LocalCell::Trying => panic!("attempt to reinitialize Local during initialization"),
            LocalCell::Init(_) => {}
        }
    }

    pub(crate) fn get<'cx, 'a, C>(cx: &'a mut C, id: usize) -> Option<&'a mut LocalCellValue>
    where
        C: Context<'cx>,
    {
        let cell = InstanceData::locals(cx).get(id);
        match cell {
            LocalCell::Init(ref mut b) => Some(b),
            _ => None,
        }
    }

    pub(crate) fn get_or_init<'cx, 'a, C, F>(
        cx: &'a mut C,
        id: usize,
        f: F,
    ) -> &'a mut LocalCellValue
    where
        C: Context<'cx>,
        F: FnOnce() -> LocalCellValue,
    {
        InstanceData::locals(cx)
            .get(id)
            .pre_init(|| LocalCell::Init(f()));

        LocalCell::get(cx, id).unwrap()
    }

    pub(crate) fn get_or_try_init<'cx, 'a, C, E, F>(
        cx: &'a mut C,
        id: usize,
        f: F,
    ) -> Result<&'a mut LocalCellValue, E>
    where
        C: Context<'cx>,
        F: FnOnce(&mut C) -> Result<LocalCellValue, E>,
    {
        // Kick off a new transaction and drop it before getting the result.
        {
            let mut tx = TryInitTransaction::new(cx, id);
            tx.run(|cx| f(cx))?;
        }

        // If we're here, the transaction has succeeded, so get the result.
        Ok(LocalCell::get(cx, id).unwrap())
    }
}

impl LocalTable {
    pub(crate) fn get(&mut self, index: usize) -> &mut LocalCell {
        if index >= self.cells.len() {
            self.cells.resize_with(index + 1, Default::default);
        }
        &mut self.cells[index]
    }
}

/// An RAII implementation of `LocalCell::get_or_try_init`, which ensures that
/// the state of a cell is properly managed through all possible control paths.
/// As soon as the transaction begins, the cell is labelled as being in a dirty
/// state (`LocalCell::Trying`), so that any additional re-entrant attempts to
/// initialize the cell will fail fast. The `Drop` implementation ensures that
/// after the transaction, the cell goes back to a clean state of either
/// `LocalCell::Uninit` if it fails or `LocalCell::Init` if it succeeds.
struct TryInitTransaction<'cx, 'a, C: Context<'cx>> {
    cx: &'a mut C,
    id: usize,
    _lifetime: PhantomData<&'cx ()>,
}

impl<'cx, 'a, C: Context<'cx>> TryInitTransaction<'cx, 'a, C> {
    fn new(cx: &'a mut C, id: usize) -> Self {
        let mut tx = Self {
            cx,
            id,
            _lifetime: PhantomData,
        };
        tx.cell().pre_init(|| LocalCell::Trying);
        tx
    }

    /// _Post-condition:_ If this method returns an `Ok` result, the cell is in the
    /// `LocalCell::Init` state.
    fn run<E, F>(&mut self, f: F) -> Result<(), E>
    where
        F: FnOnce(&mut C) -> Result<LocalCellValue, E>,
    {
        if self.is_trying() {
            let value = f(self.cx)?;
            *self.cell() = LocalCell::Init(value);
        }
        Ok(())
    }

    fn cell(&mut self) -> &mut LocalCell {
        InstanceData::locals(self.cx).get(self.id)
    }

    #[allow(clippy::wrong_self_convention)]
    fn is_trying(&mut self) -> bool {
        matches!(self.cell(), LocalCell::Trying)
    }
}

impl<'cx, 'a, C: Context<'cx>> Drop for TryInitTransaction<'cx, 'a, C> {
    fn drop(&mut self) {
        if self.is_trying() {
            *self.cell() = LocalCell::Uninit;
        }
    }
}

/// Wrapper for raw Node-API values to be dropped on the main thread
pub(crate) enum DropData {
    Deferred(NodeApiDeferred),
    Ref(NapiRef),
}

impl DropData {
    /// Drop a value on the main thread
    fn drop(env: Option<Env>, data: Self) {
        if let Some(env) = env {
            unsafe {
                match data {
                    DropData::Deferred(data) => data.leaked(env),
                    DropData::Ref(data) => data.unref(env),
                }
            }
        }
    }
}

impl InstanceData {
    /// Return the data associated with this module instance, lazily initializing if
    /// necessary.
    ///
    /// # Safety
    /// No additional locking (e.g., `Mutex`) is necessary because holding a
    /// `Context` reference ensures serialized access.
    pub(crate) fn get<'cx, C: Context<'cx>>(cx: &mut C) -> &mut InstanceData {
        let env = cx.env().to_raw();
        let data = unsafe { lifecycle::get_instance_data::<InstanceData>(env).as_mut() };

        if let Some(data) = data {
            return data;
        }

        let drop_queue = unsafe {
            let queue = ThreadsafeFunction::new(env, DropData::drop);
            queue.unref(env);
            queue
        };

        let shared_channel = {
            let mut channel = Channel::new(cx);
            channel.unref(cx);
            channel
        };

        let data = InstanceData {
            id: InstanceId::next(),
            drop_queue: Arc::new(drop_queue),
            shared_channel,
            locals: LocalTable::default(),
        };

        unsafe { &mut *lifecycle::set_instance_data(env, data) }
    }

    /// Helper to return a reference to the `drop_queue` field of `InstanceData`
    pub(crate) fn drop_queue<'cx, C: Context<'cx>>(
        cx: &mut C,
    ) -> Arc<ThreadsafeFunction<DropData>> {
        Arc::clone(&InstanceData::get(cx).drop_queue)
    }

    /// Clones the shared channel and references it since new channels should start
    /// referenced, but the shared channel is unreferenced.
    pub(crate) fn channel<'cx, C: Context<'cx>>(cx: &mut C) -> Channel {
        let mut channel = InstanceData::get(cx).shared_channel.clone();
        channel.reference(cx);
        channel
    }

    /// Unique identifier for this instance of the module
    pub(crate) fn id<'cx, C: Context<'cx>>(cx: &mut C) -> InstanceId {
        InstanceData::get(cx).id
    }

    /// Helper to return a reference to the `locals` field of `InstanceData`.
    pub(crate) fn locals<'cx, C: Context<'cx>>(cx: &mut C) -> &mut LocalTable {
        &mut InstanceData::get(cx).locals
    }
}


================================================
FILE: crates/neon/src/macro_internal/futures.rs
================================================
use std::future::Future;

use crate::{
    context::{Context, Cx, TaskContext},
    result::JsResult,
    types::JsValue,
};

pub fn spawn<'cx, F, S>(cx: &mut Cx<'cx>, fut: F, settle: S) -> JsResult<'cx, JsValue>
where
    F: Future + Send + 'static,
    F::Output: Send,
    S: FnOnce(TaskContext, F::Output) -> JsResult<JsValue> + Send + 'static,
{
    let rt = match crate::executor::RUNTIME.get(cx) {
        Some(rt) => rt,
        None => return cx.throw_error("must initialize with neon::set_global_executor"),
    };

    let ch = cx.channel();
    let (d, promise) = cx.promise();

    rt.spawn(Box::pin(async move {
        let res = fut.await;
        let _ = d.try_settle_with(&ch, move |cx| settle(cx, res));
    }));

    Ok(promise.upcast())
}


================================================
FILE: crates/neon/src/macro_internal/mod.rs
================================================
//! Internals needed by macros. These have to be exported for the macros to work

use std::marker::PhantomData;

pub use linkme;

use crate::{
    context::{Context, Cx, ModuleContext},
    handle::Handle,
    result::{JsResult, NeonResult},
    types::{extract::TryIntoJs, JsValue},
};

#[cfg(feature = "serde")]
use crate::types::extract::Json;

#[cfg(all(feature = "napi-6", feature = "futures"))]
pub use self::futures::*;

pub mod object {
    pub use crate::object::wrap::{unwrap, wrap};
}

#[cfg(all(feature = "napi-6", feature = "futures"))]
mod futures;

type Export<'cx> = (&'static str, Handle<'cx, JsValue>);

#[linkme::distributed_slice]
pub static EXPORTS: [for<'cx> fn(&mut ModuleContext<'cx>) -> NeonResult<Export<'cx>>];

#[linkme::distributed_slice]
pub static MAIN: [for<'cx> fn(ModuleContext<'cx>) -> NeonResult<()>];

// Wrapper for the value type and return type tags
pub struct NeonMarker<Tag, Return>(PhantomData<Tag>, PhantomData<Return>);

// Markers to determine the type of a value
#[cfg(feature = "serde")]
pub struct NeonJsonTag;
pub struct NeonValueTag;
pub struct NeonResultTag;

pub trait ToNeonMarker {
    type Return;

    fn to_neon_marker<Tag>(&self) -> NeonMarker<Tag, Self::Return>;
}

// Specialized implementation for `Result`
impl<T, E> ToNeonMarker for Result<T, E> {
    type Return = NeonResultTag;

    fn to_neon_marker<Tag>(&self) -> NeonMarker<Tag, Self::Return> {
        NeonMarker(PhantomData, PhantomData)
    }
}

// Default implementation that takes lower precedence due to autoref
impl<T> ToNeonMarker for &T {
    type Return = NeonValueTag;

    fn to_neon_marker<Tag>(&self) -> NeonMarker<Tag, Self::Return> {
        NeonMarker(PhantomData, PhantomData)
    }
}

impl<Return> NeonMarker<NeonValueTag, Return> {
    pub fn neon_into_js<'cx, T>(self, cx: &mut Cx<'cx>, v: T) -> JsResult<'cx, JsValue>
    where
        T: TryIntoJs<'cx>,
    {
        v.try_into_js(cx).map(|v| v.upcast())
    }
}

#[cfg(feature = "serde")]
impl NeonMarker<NeonJsonTag, NeonValueTag> {
    pub fn neon_into_js<'cx, T>(self, cx: &mut Cx<'cx>, v: T) -> JsResult<'cx, JsValue>
    where
        Json<T>: TryIntoJs<'cx>,
    {
        Json(v).try_into_js(cx).map(|v| v.upcast())
    }
}

#[cfg(feature = "serde")]
impl NeonMarker<NeonJsonTag, NeonResultTag> {
    pub fn neon_into_js<'cx, T, E>(
        self,
        cx: &mut Cx<'cx>,
        res: Result<T, E>,
    ) -> JsResult<'cx, JsValue>
    where
        Result<Json<T>, E>: TryIntoJs<'cx>,
    {
        res.map(Json).try_into_js(cx).map(|v| v.upcast())
    }
}

impl<Tag> NeonMarker<Tag, NeonValueTag> {
    pub fn into_neon_result<T>(self, _cx: &mut Cx, v: T) -> NeonResult<T> {
        Ok(v)
    }
}

impl<Tag> NeonMarker<Tag, NeonResultTag> {
    pub fn into_neon_result<'cx, T, E>(self, cx: &mut Cx<'cx>, res: Result<T, E>) -> NeonResult<T>
    where
        E: TryIntoJs<'cx>,
    {
        match res {
            Ok(v) => Ok(v),
            Err(err) => err.try_into_js(cx).and_then(|err| cx.throw(err)),
        }
    }
}

#[cfg(feature = "napi-6")]
pub use crate::object::class::new_class_metadata;

#[cfg(feature = "napi-6")]
pub use crate::types_impl::extract::private::Sealed;

#[cfg(feature = "napi-6")]
pub use crate::object::wrap::WrapError;

#[cfg(feature = "napi-6")]
pub use crate::object::class::ClassInternal;

#[cfg(feature = "napi-6")]
pub use crate::object::class::{ClassMetadata, RootClassMetadata};

#[cfg(feature = "napi-6")]
pub fn internal_constructor<'cx, T: crate::object::Class>(
    cx: &mut Cx<'cx>,
) -> NeonResult<Handle<'cx, crate::types::JsFunction>> {
    let class_instance = T::local(cx)?;
    Ok(class_instance.internal_constructor())
}


================================================
FILE: crates/neon/src/macros.rs
================================================
//! Helper module to add documentation to macros prior to re-exporting.

#[cfg(feature = "napi-6")]
/// Create a Neon class from a Rust datatype
///
/// The `#[neon::class]` attribute can be applied to an `impl` block to create a JavaScript
/// class that wraps a Rust struct (or enum). The `impl` block specifies a constructor method named
/// `new` to create instances of the struct, which Neon automatically attaches to instances of the
/// JavaScript class during object construction.
///
/// Typically, Neon classes are exported from their addon, which can be done with the
/// [`#[neon::export(class)]`](crate::export) attribute.
///
/// ## Example
///
/// ```
/// # use neon::prelude::*;
/// # use neon::{context::Context, types::Finalize};
/// #[derive(Clone)]
/// pub struct User {
///     username: String,
///     first_name: String,
///     last_name: String,
/// }
///
/// #[neon::export(class)]
/// impl User {
///     pub fn new(username: String, first_name: String, last_name: String) -> Self {
///         Self { username, first_name, last_name }
///     }
///
///     pub fn to_string(&self) -> String {
///         format!("[object User:{}]", self.username)
///     }
/// }
/// ```
///
/// ## Constructor
///
/// Classes must have exactly one constructor method named `new`. The constructor takes
/// the class parameters and returns `Self`. Constructor arguments can be any type that
/// implements [`TryFromJs`](crate::types::extract::TryFromJs).
///
/// ```
/// # use neon::prelude::*;
/// # use neon::types::Finalize;
/// pub struct Person {
///     name: String,
///     age: u32,
/// }
///
/// #[neon::class]
/// impl Person {
///     pub fn new(name: String, age: u32) -> Self {
///         Self { name, age }
///     }
/// }
/// ```
///
/// ## Methods
///
/// Class methods can have either `&self` or `&mut self` as their first parameter.
/// Methods can take any type that implements [`TryFromJs`](crate::types::extract::TryFromJs)
/// and return any type that implements [`TryIntoJs`](crate::types::extract::TryIntoJs).
///
/// ```
/// # use neon::prelude::*;
/// # use neon::types::Finalize;
/// pub struct Counter {
///     value: i32,
/// }
///
/// #[neon::class]
/// impl Counter {
///     pub fn new(initial: i32) -> Self {
///         Self { value: initial }
///     }
///
///     pub fn increment(&mut self) -> i32 {
///         self.value += 1;
///         self.value
///     }
///
///     pub fn get(&self) -> i32 {
///         self.value
///     }
/// }
/// ```
///
/// ### Reference Parameters
///
/// Methods can accept class instances by reference (`&T`) or mutable reference (`&mut T`)
/// to avoid cloning when passing instances between methods. The type must implement
/// [`TryFromJsRef`](crate::types::extract::TryFromJsRef) for immutable references or
/// [`TryFromJsRefMut`](crate::types::extract::TryFromJsRefMut) for mutable references.
/// The `#[neon::class]` macro automatically implements these traits for all class types.
///
/// ```
/// # use neon::prelude::*;
/// # use neon::types::Finalize;
/// #[derive(Clone)]
/// pub struct Point {
///     x: f64,
///     y: f64,
/// }
///
/// #[neon::class]
/// impl Point {
///     pub fn new(x: f64, y: f64) -> Self {
///         Self { x, y }
///     }
///
///     // Accept another Point by immutable reference (no clone)
///     pub fn distance(&self, other: &Self) -> f64 {
///         let dx = self.x - other.x;
///         let dy = self.y - other.y;
///         (dx * dx + dy * dy).sqrt()
///     }
///
///     // Accept another Point by mutable reference (no clone)
///     pub fn swap_coordinates(&mut self, other: &mut Self) {
///         std::mem::swap(&mut self.x, &mut other.x);
///         std::mem::swap(&mut self.y, &mut other.y);
///     }
///
///     // Accept another Point by value (clones the instance)
///     pub fn midpoint(&self, other: Self) -> Self {
///         Self {
///             x: (self.x + other.x) / 2.0,
///             y: (self.y + other.y) / 2.0,
///         }
///     }
/// }
/// ```
///
/// From JavaScript:
/// ```js
/// const p1 = new Point(0, 0);
/// const p2 = new Point(3, 4);
///
/// console.log(p1.distance(p2));    // 5 (no cloning)
///
/// p1.swapCoordinates(p2);          // Mutates both points
/// console.log(p1.x);               // 3
/// console.log(p2.x);               // 0
///
/// const mid = p1.midpoint(p2);     // Clones p2
/// ```
///
/// **When to use references:**
/// - Use `&T` when you only need to read from the instance
/// - Use `&mut T` when you need to mutate the instance
/// - Use `T` (by value) when the semantics require taking ownership
///
/// Note that reference parameters still use [`RefCell`](std::cell::RefCell) internally,
/// so runtime borrow checking applies. Attempting to borrow the same instance both mutably
/// and immutably (or multiple times mutably) will panic.
///
/// ## Finalizer
///
/// Classes can implement a `finalize` method to perform cleanup when the
/// JavaScript object is garbage collected. The `finalize` method takes
/// ownership of the class instance and is called when the object is no longer
/// reachable from JavaScript.
///
/// ```
/// # use neon::prelude::*;
/// pub struct Logger {
///     name: String,
/// }
///
/// #[neon::class]
/// impl Logger {
///     pub fn new(name: String) -> Self {
///         Self { name }
///     }
///
///     pub fn finalize<'cx, C: Context<'cx>>(self, _cx: &mut C) {
///         println!("Logger {} is being finalized", self.name);
///     }
/// }
/// ```
///
/// ## Mutability and Borrow Checking
///
/// Neon classes use [`RefCell`](std::cell::RefCell) internally to allow mutation through
/// `&mut self` methods while maintaining JavaScript's shared ownership semantics. This means
/// that borrow checking happens at runtime, not compile time, and violating Rust's borrowing
/// rules will cause a panic.
///
/// **Important:** You cannot call a method that requires `&mut self` while another method
/// is borrowing the instance (even with `&self`). This includes:
/// - Reentrancy from JavaScript callbacks
/// - Nested method calls on the same instance
///
/// For complex scenarios involving callbacks or shared mutable state across threads,
/// consider using additional interior mutability types like
/// [`Arc<Mutex<T>>`](std::sync::Arc) for the specific fields that need it.
///
/// ### Method Attributes
///
/// Methods support the same attributes as [`#[neon::export]`](crate::export) functions, including
/// `json`, `task`, `async`, `context`, `this`, and `name`, and may be fallible by returning
/// `Result` types.
///
/// #### JSON Methods
///
/// ```
/// # use neon::prelude::*;
/// # use neon::types::Finalize;
/// pub struct DataProcessor;
///
/// #[neon::class]
/// impl DataProcessor {
///     pub fn new() -> Self {
///         Self
///     }
///
///     #[neon(json)]
///     pub fn process_data(&self, items: Vec<String>) -> Vec<String> {
///         items.into_iter().map(|s| s.to_uppercase()).collect()
///     }
/// }
/// ```
///
/// #### Async Methods
///
/// Methods declared with `async fn` are automatically detected and exported as async. The
/// macro automatically clones the instance before calling the method. Because Rust's `async fn`
/// captures `self` into the Future (which must be `'static`), the method must take `self` by
/// value (not `&self` or `&mut self`) and the struct must implement `Clone`. Any shared mutable
/// state should use types like [`Arc<Mutex<T>>`](std::sync::Arc) for thread-safe interior
/// mutability.
///
/// ```
/// # #[cfg(all(feature = "napi-6", feature = "futures"))]
/// # {
/// # use neon::prelude::*;
/// # use neon::types::Finalize;
/// # use std::sync::{Arc, Mutex};
/// # #[derive(Clone)]
/// # pub struct AsyncWorker {
/// #     counter: Arc<Mutex<i32>>,
/// # }
/// #[neon::class]
/// impl AsyncWorker {
///     pub fn new() -> Self {
///         Self {
///             counter: Arc::new(Mutex::new(0)),
///         }
///     }
///
///     // Must take `self` by value; the macro clones the instance automatically
///     pub async fn fetch_data(self, url: String) -> String {
///         // Simulate async work
///         let mut count = self.counter.lock().unwrap();
///         *count += 1;
///         format!("Data from {} (request #{})", url, count)
///     }
/// }
/// # }
/// ```
///
/// ##### Synchronous Setup
///
/// For more control over async behavior, use `#[neon(async)]` with a method that
/// returns a [`Future`](std::future::Future). This allows synchronous setup on
/// the JavaScript main thread. With this approach, the method takes `&self` and you
/// are responsible for cloning any data needed to make the returned Future `'static`.
///
/// ```
/// # #[cfg(all(feature = "napi-6", feature = "futures"))]
/// # {
/// # use neon::prelude::*;
/// # use neon::types::Finalize;
/// # use std::future::Future;
/// # #[derive(Clone)]
/// # pub struct AsyncWorker {
/// #     value: String,
/// # }
/// #[neon::class]
/// impl AsyncWorker {
/// #   pub fn new() -> Self { Self { value: String::new() } }
///     #[neon(async)]
///     pub fn process_data(&self, data: String) -> impl Future<Output = String> + 'static {
///         println!("Setup on main thread");
///         // Clone any instance data you need for the Future
///         let value = self.value.clone();
///         async move {
///             format!("{}: {}", value, data.to_uppercase())
///         }
///     }
/// }
/// # }
/// ```
///
/// #### Task Methods
///
/// Methods can be executed on Node's worker pool using the `task` attribute. The macro
/// automatically clones the instance before moving it to the worker thread, so the struct
/// must implement `Clone`. Like `async fn` methods, task methods must take `self` by value
/// (not `&self` or `&mut self`) to make it clear that they operate on a clone.
///
/// ```
/// # use neon::prelude::*;
/// # use neon::types::Finalize;
/// #[derive(Clone)]
/// pub struct CpuWorker {
///     multiplier: u32,
/// }
///
/// #[neon::class]
/// impl CpuWorker {
///     pub fn new(multiplier: u32) -> Self {
///         Self { multiplier }
///     }
///
///     // Must take `self` by value; the macro clones the instance automatically
///     #[neon(task)]
///     pub fn heavy_computation(self, iterations: u32) -> u32 {
///         (0..iterations).map(|i| i * self.multiplier).sum()
///     }
/// }
/// ```
///
/// #### Method Naming
///
/// Like [`#[neon::export]`](crate::export) functions, method names are converted from `snake_case`
/// to `camelCase`. Custom names can be specified with the `name` attribute:
///
/// ```
/// # use neon::prelude::*;
/// # use neon::types::Finalize;
/// pub struct Label {
///     data: String,
/// }
///
/// #[neon::class]
/// impl Label {
///     pub fn new() -> Self {
///         Self { data: String::new() }
///     }
///
///     #[neon(name = "trimStart")]
///     pub fn trim_leading(&self) -> String {
///         self.data.trim_start().to_string()
///     }
/// }
/// ```
///
/// #### Fallible Methods
///
/// Methods can return `Result` types to throw JavaScript exceptions, just like
/// `#[neon::export]` functions.
///
/// ```
/// # use neon::prelude::*;
/// pub struct User {
///     name: String,
/// }
///
/// #[neon::class]
/// impl User {
///     pub fn new(name: String) -> Self {
///         Self { name }
///     }
///
///     pub fn get_name(&self) -> String {
///         self.name.clone()
///     }
///
///     pub fn set_name(&mut self, name: String) -> Result<(), &'static str> {
///         if name.is_empty() {
///             return Err("Name cannot be empty");
///         }
///
///         self.name = name;
///
///         Ok(())
///     }
/// }
/// ```
///
/// ### Constructor Attributes
///
/// Constructor methods support the `json` and `context` attributes and may be fallible as well.
///
/// ```
/// # use neon::prelude::*;
/// # use neon::types::extract::Json;
/// pub struct Argv {
///     pub args: Vec<String>,
/// }
///
/// #[neon::class]
/// impl Argv {
///     // context attribute is inferred automatically
///     #[neon(json)]
///     pub fn new(cx: &mut Cx, args: Option<Vec<String>>) -> NeonResult<Self> {
///         let args = if let Some(args) = args { args } else {
///             let Json(args): Json<Vec<String>> = cx
///                 .global::<JsObject>("process")?
///                 .prop(cx, "argv")
///                 .get()?;
///             args
///         };
///         Ok(Self { args } )
///     }
///
///     pub fn len(&self) -> u32 {
///         self.args.len() as u32
///     }
///
///     pub fn get(&self, index: u32) -> Option<String> {
///         self.args.get(index as usize).cloned()
///     }
/// }
/// ```
///
/// ## Const Properties
///
/// Classes can expose Rust constants as static, immutable properties on the JavaScript class:
///
/// ```
/// # use neon::prelude::*;
/// # use neon::types::Finalize;
/// pub struct MathConstants;
///
/// #[neon::class]
/// impl MathConstants {
///     const PI: f64 = 3.14159;
///     const VERSION: u32 = 1;
///
///     #[neon(name = "maxValue")]
///     const MAX_VALUE: f64 = f64::MAX;
///
///     #[neon(json)]
///     const DEFAULT_SETTINGS: &'static [&'static str] = &["feature1", "feature2"];
///
///     pub fn new() -> Self {
///         Self
///     }
/// }
/// ```
///
/// From JavaScript:
/// ```js
/// console.log(MathConstants.PI);               // 3.14159
/// console.log(MathConstants.maxValue);         // 1.7976931348623157e+308
/// console.log(MathConstants.DEFAULT_SETTINGS); // ["feature1", "feature2"]
/// ```
///
/// Const properties support the same attributes as globals: `name` for custom naming
/// and `json` for automatic JSON serialization. Properties are immutable from JavaScript.
///
/// ## Context and This Parameters
///
/// Methods can access the JavaScript runtime context and the JavaScript object wrapper:
///
/// ```
/// # use neon::prelude::*;
/// # use neon::types::Finalize;
/// pub struct Interactive {
///     data: String,
/// }
///
/// #[neon::class]
/// impl Interactive {
///     pub fn new(data: String) -> Self {
///         Self { data }
///     }
///
///     // Method with context parameter
///     pub fn create_object<'cx>(
///         &self,
///         cx: &mut FunctionContext<'cx>,
///     ) -> JsResult<'cx, JsObject> {
///         let obj = cx.empty_object();
///         let value = cx.string(&self.data);
///         obj.set(cx, "data", value)?;
///         Ok(obj)
///     }
///
///     // Method with this parameter (access to JS object)
///     pub fn inspect_this(&self, this: Handle<JsObject>) -> String {
///         format!("JS object available: {}", self.data)
///     }
/// }
/// ```
///
/// ## Working with Class Instances
///
/// Methods can accept and return instances of the same class directly. When a class instance
/// is passed as a parameter or returned from a method, it is automatically cloned from (or into)
/// the internal [`RefCell`](std::cell::RefCell) storage, so the struct must implement `Clone`.
///
/// ```
/// # use neon::prelude::*;
/// # use neon::types::Finalize;
/// #[derive(Clone)]
/// pub struct Point {
///     x: f64,
///     y: f64,
/// }
///
/// #[neon::class]
/// impl Point {
///     pub fn new(x: f64, y: f64) -> Self {
///         Self { x, y }
///     }
///
///     pub fn distance(&self, other: Self) -> f64 {
///         let dx = self.x - other.x;
///         let dy = self.y - other.y;
///         (dx * dx + dy * dy).sqrt()
///     }
///
///     pub fn midpoint(&self, other: Self) -> Self {
///         Self {
///             x: (self.x + other.x) / 2.0,
///             y: (self.y + other.y) / 2.0,
///         }
///     }
/// }
/// ```
///
/// From JavaScript, you can call these methods with other instances of the same class:
/// ```js
/// const p1 = new Point(0, 0);
/// const p2 = new Point(3, 4);
/// console.log(p1.distance(p2)); // 5
/// const midpoint = p1.midpoint(p2); // Point { x: 1.5, y: 2 }
/// ```
///
/// ## Export Shorthand
///
/// Use [`#[neon::export(class)]`](crate::export) to combine class definition with
/// automatic module export:
///
/// ```
/// # use neon::prelude::*;
/// # use neon::types::Finalize;
/// pub struct AutoExported {
///     value: u32,
/// }
///
/// // Combines #[neon::class] with automatic export
/// #[neon::export(class)]
/// impl AutoExported {
///     pub fn new(value: u32) -> Self {
///         Self { value }
///     }
/// }
/// ```
///
/// Like other exports, classes can be exported with custom names:
///
/// ```
/// # use neon::prelude::*;
/// # use neon::types::Finalize;
/// pub struct InternalPoint {
///     x: f64,
///     y: f64,
/// }
///
/// // Export as "Point" instead of "InternalPoint"
/// #[neon::export(class(name = "Point"))]
/// impl InternalPoint {
///     pub fn new(x: f64, y: f64) -> Self {
///         Self { x, y }
///     }
///
///     pub fn distance_from_origin(&self) -> f64 {
///         (self.x * self.x + self.y * self.y).sqrt()
///     }
/// }
/// ```
///
/// It's also possible to distinguish between the class name and export name:
///
/// ```
/// # use neon::prelude::*;
/// pub struct RustPoint {
///     x: f64,
///     y: f64,
/// }
///
/// // Export as "Point" but with Point.name === "NeonPoint"
/// #[neon::export(class(name = "NeonPoint"), name = "Point")]
/// impl RustPoint {
///     pub fn new(x: f64, y: f64) -> Self {
///         Self { x, y }
///     }
/// }
/// ```
///
/// ## Error Handling
///
/// Methods can return [`Result`] types to throw JavaScript exceptions, just like
/// [`#[neon::export]`](crate::export) functions:
///
/// ```
/// # use neon::prelude::*;
/// # use neon::types::{Finalize, extract::Error};
/// pub struct FileReader;
///
/// #[neon::class]
/// impl FileReader {
///     pub fn new() -> Self {
///         Self
///     }
///
///     pub fn read_file(&self, path: String) -> Result<String, Error> {
///         std::fs::read_to_string(path).map_err(Error::from)
///     }
/// }
/// ```
///
/// ## `Class` Trait
///
/// The `#[neon::class]` macro automatically implements the [`Class`](crate::object::Class)
/// trait for the struct. This trait can be used to access the constructor function at runtime.
///
/// ```
/// # use neon::prelude::*;
/// # use neon::types::Finalize;
/// use neon::object::Class;
/// # #[derive(Clone)]
/// # pub struct Point {
/// #     x: f64,
/// #     y: f64,
/// # }
/// #
/// # #[neon::class]
/// # impl Point {
/// #     pub fn new(x: f64, y: f64) -> Self {
/// #         Self { x, y }
/// #     }
/// # }
///
/// # fn init_statics<'cx>(cx: &mut FunctionContext<'cx>) -> JsResult<'cx, JsUndefined> {
/// let constructor = Point::constructor(cx)?;
/// constructor
///     .prop(cx, "ORIGIN")
///     .set(Point::new(0.0, 0.0))?;
/// # Ok(cx.undefined())
/// # }
/// ```
pub use neon_macros::class;

/// Marks a function as the main entry point for initialization in
/// a Neon module.
///
/// This attribute should only be used _once_ in a module and will
/// be called each time the module is initialized in a context.
///
/// If a `main` function is not provided, all registered exports will be exported. If
/// the `tokio` feature flag is enabled, a multithreaded tokio runtime will also be
/// registered globally.
///
/// ```
/// # use neon::prelude::*;
/// # fn main() {
/// #[neon::main]
/// fn main(mut cx: ModuleContext) -> NeonResult<()> {
///     // Export all registered exports
///     neon::registered().export(&mut cx)?;
///
///     let version = cx.string("1.0.0");
///
///     cx.export_value("version", version)?;
///
///     Ok(())
/// }
/// # }
/// ```
pub use neon_macros::main;

/// Register an item to be exported by the Neon addon
///
/// ## Exporting constants and statics
///
/// ```
/// #[neon::export]
/// static GREETING: &str = "Hello, Neon!";
///
/// #[neon::export]
/// const ANSWER: u8 = 42;
/// ```
///
/// ### Renaming an export
///
/// By default, items will be exported with their Rust name. Exports may
/// be renamed by providing the `name` attribute.
///
/// ```
/// #[neon::export(name = "myGreeting")]
/// static GREETING: &str = "Hello, Neon!";
/// ```
///
/// ### JSON exports
///
/// Complex values may be exported by automatically serializing to JSON and
/// parsing in JavaScript. Any type that implements `serde::Serialize` may be used.
///
/// ```
/// #[neon::export(json)]
/// static MESSAGES: &[&str] = &["hello", "goodbye"];
/// ```
///
/// ## Exporting functions
///
/// Functions may take any type that implements [`TryFromJs`](crate::types::extract::TryFromJs) as
/// an argument and return any type that implements [`TryIntoJs`](crate::types::extract::TryIntoJs).
///
/// ```
/// #[neon::export]
/// fn add(a: f64, b: f64) -> f64 {
///     a + b
/// }
/// ```
///
/// ### Naming exported functions
///
/// Conventionally, Rust uses `snake_case` for function identifiers and JavaScript uses `camelCase`.
/// By default, Neon will attempt to convert function names to camel case. For example:
///
/// ```rust
/// #[neon::export]
/// fn add_one(n: f64) -> f64 {
///     n + 1.0
/// }
/// ```
///
/// The `add_one` function will be exported as `addOne` in JavaScript.
///
/// ```js
/// import { addOne } from ".";
/// ```
///
/// [Similar to globals](#renaming-an-export), exported functions can be overridden with the `name`
/// attribute.
///
/// ```rust
/// #[neon::export(name = "addOneSync")]
/// fn add_one(n: f64) -> f64 {
///     n + 1.0
/// }
/// ```
/// Neon uses the following rules when converting `snake_case` to `camelCase`:
///
/// * All _leading_ and _trailing_ underscores (`_`) are preserved
/// * Characters _immediately_ following a _non-leading_ underscore are converted to uppercase
/// * If the identifier contains an _unexpected_ character, **no** conversion is performed and
///   the identifier is used _unchanged_. Unexpected characters include:
///   - Uppercase characters
///   - Duplicate _interior_ (non-leading, non-trailing underscores)
///
/// ### Exporting a function that uses JSON
///
/// The [`Json`](crate::types::extract::Json) wrapper allows ergonomically handling complex
/// types that implement `serde::Deserialize` and `serde::Serialize`.
///
/// ```
/// # use neon::types::extract::Json;
/// #[neon::export]
/// fn sort(Json(mut items): Json<Vec<String>>) -> Json<Vec<String>> {
///     items.sort();
///     Json(items)
/// }
/// ```
///
/// As a convenience, macro uses may add the `json` attribute to automatically
/// wrap arguments and return values with `Json`.
///
/// ```
/// #[neon::export(json)]
/// fn sort(mut items: Vec<String>) -> Vec<String> {
///     items.sort();
///     items
/// }
/// ```
///
/// ### Tasks
///
/// Neon provides an API for spawning tasks to execute asynchronously on Node's worker
/// pool. JavaScript may await a promise for completion of the task.
///
/// ```
/// # use neon::prelude::*;
/// #[neon::export]
/// fn add<'cx>(cx: &mut FunctionContext<'cx>, a: f64, b: f64) -> JsResult<'cx, JsPromise> {
///     let promise = cx
///         .task(move || a + b)
///         .promise(|mut cx, res| Ok(cx.number(res)));
///
///     Ok(promise)
/// }
/// ```
///
/// As a convenience, macro users may indicate that a function should be executed
/// asynchronously on the worker pool by adding the `task` attribute.
///
/// ```
/// #[neon::export(task)]
/// fn add(a: f64, b: f64) -> f64 {
///     a + b
/// }
/// ```
///
/// ### Async Functions
///
/// The [`export`] macro can export `async fn`, converting to a JavaScript `Promise`, if a global
/// future executor is registered. See [`neon::set_global_executor`](crate::set_global_executor) for
/// more details.
///
/// ```
/// # #[cfg(all(feature = "napi-6", feature = "futures"))]
/// # {
/// #[neon::export]
/// async fn add(a: f64, b: f64) -> f64 {
///     a + b
/// }
/// # }
/// ```
///
/// #### Synchronous Setup
///
/// To implement a function that appears asynchronous to JavaScript, but needs to perform
/// some synchronous setup on the JavaScript main thread, a normal (i.e., non-`async`) Rust
/// function that returns a [`Future`](std::future::Future) can be annotated with
/// `#[neon::export(async)]`.
///
/// ```
/// # #[cfg(all(feature = "napi-6", feature = "futures"))]
/// # {
/// # use std::future::Future;
/// # use neon::prelude::*;
/// #[neon::export(async)]
/// fn add(a: f64, b: f64) -> impl Future<Output = f64> {
///     println!("Hello from the JavaScript main thread!");
///
///     async move {
///         a + b
///     }
/// }
/// # }
/// ```
///
/// If work needs to be performed on the JavaScript main thread _after_ the asynchronous operation,
/// the [`With`](crate::types::extract::With) extractor can be used to execute a closure before returning.
///
/// ```
/// # #[cfg(all(feature = "napi-6", feature = "futures"))]
/// # {
/// # use neon::types::extract::{self, TryIntoJs};
/// #[neon::export]
/// async fn add(a: f64, b: f64) -> impl for<'cx> TryIntoJs<'cx> {
///     let sum = a + b;
///
///     extract::with(move |cx| {
///         println!("Hello from the JavaScript main thread!");
///
///         sum.try_into_js(cx)
///     })
/// }
/// # }
/// ```
///
/// ### Error Handling
///
/// If an exported function returns a [`Result`], a JavaScript exception will be thrown
/// with the [`Err`]. Any error type that implements [`TryIntoJs`](crate::types::extract::TryIntoJs)
/// may be used.
///
/// ```
/// #[neon::export]
/// fn throw(msg: String) -> Result<(), String> {
///     Err(msg)
/// }
/// ```
///
/// The [`Error`](crate::types::extract::Error) type is provided for ergonomic error conversions
/// from most error types using the `?` operator.
///
/// ```
/// use neon::types::extract::Error;
///
/// #[neon::export]
/// fn read_file(path: String) -> Result<String, Error> {
///     let contents = std::fs::read_to_string(path)?;
///     Ok(contents)
/// }
/// ```
///
/// ### Interact with the JavaScript runtime
///
/// More complex functions may need to interact directly with the JavaScript runtime,
/// for example with [`Context`](crate::context::Context) or handles to JavaScript values.
///
/// Functions may optionally include a [`Cx`](crate::context::Cx) or
/// [`FunctionContext`](crate::context::FunctionContext) argument. Note that unlike functions
/// created with [`JsFunction::new`](crate::types::JsFunction), exported function receive a borrowed
/// context and may require explicit lifetimes.
///
/// ```
/// # use neon::prelude::*;
/// #[neon::export]
/// fn add<'cx>(
///     cx: &mut Cx<'cx>,
///     a: Handle<JsNumber>,
///     b: Handle<JsNumber>,
/// ) -> JsResult<'cx, JsNumber> {
///     let a = a.value(cx);
///     let b = b.value
Download .txt
gitextract_5xdlnvd5/

├── .cargo/
│   └── config.toml
├── .editorconfig
├── .github/
│   └── workflows/
│       ├── bench.yml
│       ├── ci.yml
│       └── lint.yml
├── .gitignore
├── .prettierignore
├── AUTHORS.md
├── CODE_OF_CONDUCT.md
├── CONTRIBUTING.md
├── Cargo.toml
├── LICENSE-APACHE
├── LICENSE-MIT
├── README.md
├── RELEASES.md
├── bench/
│   ├── .gitignore
│   ├── Cargo.toml
│   ├── README.md
│   ├── index.js
│   ├── package.json
│   └── src/
│       └── lib.rs
├── codecov.yml
├── crates/
│   ├── neon/
│   │   ├── Cargo.toml
│   │   └── src/
│   │       ├── context/
│   │       │   ├── internal.rs
│   │       │   └── mod.rs
│   │       ├── event/
│   │       │   ├── channel.rs
│   │       │   ├── mod.rs
│   │       │   └── task.rs
│   │       ├── executor/
│   │       │   ├── mod.rs
│   │       │   └── tokio.rs
│   │       ├── handle/
│   │       │   ├── internal.rs
│   │       │   ├── mod.rs
│   │       │   └── root.rs
│   │       ├── lib.rs
│   │       ├── lifecycle.rs
│   │       ├── macro_internal/
│   │       │   ├── futures.rs
│   │       │   └── mod.rs
│   │       ├── macros.rs
│   │       ├── meta.rs
│   │       ├── object/
│   │       │   ├── class.rs
│   │       │   ├── mod.rs
│   │       │   └── wrap.rs
│   │       ├── prelude.rs
│   │       ├── reflect.rs
│   │       ├── result/
│   │       │   └── mod.rs
│   │       ├── sys/
│   │       │   ├── array.rs
│   │       │   ├── arraybuffer.rs
│   │       │   ├── async_work.rs
│   │       │   ├── bindings/
│   │       │   │   ├── functions.rs
│   │       │   │   ├── mod.rs
│   │       │   │   └── types.rs
│   │       │   ├── buffer.rs
│   │       │   ├── call.rs
│   │       │   ├── convert.rs
│   │       │   ├── date.rs
│   │       │   ├── debug_send_wrapper.rs
│   │       │   ├── error.rs
│   │       │   ├── external.rs
│   │       │   ├── fun.rs
│   │       │   ├── lifecycle.rs
│   │       │   ├── mem.rs
│   │       │   ├── mod.rs
│   │       │   ├── no_panic.rs
│   │       │   ├── object.rs
│   │       │   ├── primitive.rs
│   │       │   ├── promise.rs
│   │       │   ├── raw.rs
│   │       │   ├── reference.rs
│   │       │   ├── scope.rs
│   │       │   ├── string.rs
│   │       │   ├── tag.rs
│   │       │   ├── tsfn.rs
│   │       │   └── typedarray.rs
│   │       ├── thread/
│   │       │   └── mod.rs
│   │       ├── types_docs.rs
│   │       └── types_impl/
│   │           ├── bigint.rs
│   │           ├── boxed.rs
│   │           ├── buffer/
│   │           │   ├── lock.rs
│   │           │   ├── mod.rs
│   │           │   └── types.rs
│   │           ├── date.rs
│   │           ├── error.rs
│   │           ├── extract/
│   │           │   ├── array.rs
│   │           │   ├── boxed.rs
│   │           │   ├── buffer.rs
│   │           │   ├── container.rs
│   │           │   ├── either.rs
│   │           │   ├── error.rs
│   │           │   ├── json.rs
│   │           │   ├── mod.rs
│   │           │   ├── private.rs
│   │           │   ├── try_from_js.rs
│   │           │   ├── try_into_js.rs
│   │           │   └── with.rs
│   │           ├── function/
│   │           │   ├── mod.rs
│   │           │   └── private.rs
│   │           ├── mod.rs
│   │           ├── private.rs
│   │           ├── promise.rs
│   │           └── utf8.rs
│   └── neon-macros/
│       ├── Cargo.toml
│       ├── LICENSE-APACHE
│       ├── LICENSE-MIT
│       └── src/
│           ├── class/
│           │   ├── meta.rs
│           │   └── mod.rs
│           ├── export/
│           │   ├── class/
│           │   │   └── meta.rs
│           │   ├── class.rs
│           │   ├── function/
│           │   │   ├── meta.rs
│           │   │   └── mod.rs
│           │   ├── global/
│           │   │   ├── meta.rs
│           │   │   └── mod.rs
│           │   └── mod.rs
│           ├── lib.rs
│           └── name.rs
├── doc/
│   ├── MIGRATION_GUIDE_0.10.md
│   ├── MIGRATION_GUIDE_1.0.0.md
│   └── MIGRATION_GUIDE_NAPI.md
├── package.json
├── pkgs/
│   ├── cargo-cp-artifact/
│   │   ├── LICENSE
│   │   ├── README.md
│   │   ├── bin/
│   │   │   └── cargo-cp-artifact.js
│   │   ├── package.json
│   │   ├── src/
│   │   │   ├── args.js
│   │   │   └── index.js
│   │   └── test/
│   │       └── args.js
│   └── create-neon/
│       ├── .mocharc.json
│       ├── README.md
│       ├── data/
│       │   ├── templates/
│       │   │   ├── .gitignore.hbs
│       │   │   ├── Cargo.toml.hbs
│       │   │   ├── README.md.hbs
│       │   │   ├── Workspace.toml.hbs
│       │   │   ├── ci/
│       │   │   │   └── github/
│       │   │   │       ├── build.yml.hbs
│       │   │   │       ├── release.yml.hbs
│       │   │   │       ├── setup.yml.hbs
│       │   │   │       └── test.yml.hbs
│       │   │   ├── lib.rs.hbs
│       │   │   ├── manifest/
│       │   │   │   └── base/
│       │   │   │       ├── default.json.hbs
│       │   │   │       └── library.json.hbs
│       │   │   ├── ts/
│       │   │   │   ├── index.cts.hbs
│       │   │   │   ├── index.mts.hbs
│       │   │   │   └── load.cts.hbs
│       │   │   └── tsconfig.json.hbs
│       │   └── versions.json
│       ├── dev/
│       │   └── expect.ts
│       ├── package.json
│       ├── src/
│       │   ├── bin/
│       │   │   └── create-neon.ts
│       │   ├── cache/
│       │   │   └── npm.ts
│       │   ├── cache.ts
│       │   ├── ci/
│       │   │   └── github.ts
│       │   ├── ci.ts
│       │   ├── create/
│       │   │   ├── app.ts
│       │   │   ├── creator.ts
│       │   │   └── lib.ts
│       │   ├── die.ts
│       │   ├── expand/
│       │   │   ├── context.ts
│       │   │   ├── index.ts
│       │   │   └── versions.ts
│       │   ├── fs.ts
│       │   ├── index.ts
│       │   ├── print.ts
│       │   └── shell.ts
│       ├── test/
│       │   └── create-neon.ts
│       └── tsconfig.json
└── test/
    ├── electron/
    │   ├── Cargo.toml
    │   ├── README.md
    │   ├── index.html
    │   ├── main.js
    │   ├── main.test.js
    │   ├── package.json
    │   ├── preload.js
    │   ├── renderer.js
    │   └── src/
    │       └── lib.rs
    ├── napi/
    │   ├── .gitignore
    │   ├── Cargo.toml
    │   ├── README.md
    │   ├── lib/
    │   │   ├── arrays.js
    │   │   ├── bigint.js
    │   │   ├── boxed.js
    │   │   ├── class.js
    │   │   ├── coercions.js
    │   │   ├── container.js
    │   │   ├── date.js
    │   │   ├── errors.js
    │   │   ├── export.js
    │   │   ├── extract.js
    │   │   ├── functions.js
    │   │   ├── futures.js
    │   │   ├── hello.js
    │   │   ├── numbers.js
    │   │   ├── objects.js
    │   │   ├── strings.js
    │   │   ├── threads.js
    │   │   ├── typedarrays.js
    │   │   ├── types.js
    │   │   └── workers.js
    │   ├── package.json
    │   └── src/
    │       ├── js/
    │       │   ├── arrays.rs
    │       │   ├── bigint.rs
    │       │   ├── boxed.rs
    │       │   ├── class.rs
    │       │   ├── coercions.rs
    │       │   ├── container.rs
    │       │   ├── date.rs
    │       │   ├── errors.rs
    │       │   ├── export.rs
    │       │   ├── extract.rs
    │       │   ├── functions.rs
    │       │   ├── futures.rs
    │       │   ├── numbers.rs
    │       │   ├── objects.rs
    │       │   ├── strings.rs
    │       │   ├── threads.rs
    │       │   ├── typedarrays.rs
    │       │   ├── types.rs
    │       │   └── workers.rs
    │       └── lib.rs
    ├── rust-2024/
    │   ├── .gitignore
    │   ├── Cargo.toml
    │   ├── README.md
    │   ├── package.json
    │   └── src/
    │       └── lib.rs
    └── ui/
        ├── Cargo.toml
        ├── src/
        │   └── lib.rs
        └── tests/
            ├── fail/
            │   ├── class-async-borrowed-channel.rs
            │   ├── class-async-borrowed-channel.stderr
            │   ├── class-async-context-ref.rs
            │   ├── class-async-context-ref.stderr
            │   ├── class-async-fn-borrowed-self.rs
            │   ├── class-async-fn-borrowed-self.stderr
            │   ├── class-async-owned-context.rs
            │   ├── class-async-owned-context.stderr
            │   ├── class-borrowed-channel-sync.rs
            │   ├── class-borrowed-channel-sync.stderr
            │   ├── class-channel-in-sync.rs
            │   ├── class-channel-in-sync.stderr
            │   ├── class-constructor-self-receiver.rs
            │   ├── class-constructor-self-receiver.stderr
            │   ├── class-constructor-with-self.rs
            │   ├── class-constructor-with-self.stderr
            │   ├── class-duplicate-property-names.rs
            │   ├── class-duplicate-property-names.stderr
            │   ├── class-immutable-context.rs
            │   ├── class-immutable-context.stderr
            │   ├── class-invalid-item-type.rs
            │   ├── class-invalid-item-type.stderr
            │   ├── class-invalid-property-name.rs
            │   ├── class-invalid-property-name.stderr
            │   ├── class-method-missing-self.rs
            │   ├── class-method-missing-self.stderr
            │   ├── class-missing-forced-context.rs
            │   ├── class-missing-forced-context.stderr
            │   ├── class-multiple-constructors.rs
            │   ├── class-multiple-constructors.stderr
            │   ├── class-multiple-finalizers.rs
            │   ├── class-multiple-finalizers.stderr
            │   ├── class-multiple-neon-attrs-const.rs
            │   ├── class-multiple-neon-attrs-const.stderr
            │   ├── class-multiple-neon-attrs-method.rs
            │   ├── class-multiple-neon-attrs-method.stderr
            │   ├── class-owned-context.rs
            │   ├── class-owned-context.stderr
            │   ├── missing-class-clone.rs
            │   ├── missing-class-clone.stderr
            │   ├── missing-class-default.rs
            │   ├── missing-class-default.stderr
            │   ├── missing-context.rs
            │   ├── missing-context.stderr
            │   ├── need-borrowed-context.rs
            │   ├── need-borrowed-context.stderr
            │   ├── unexpected-self.rs
            │   ├── unexpected-self.stderr
            │   ├── unnecessary-attribute.rs
            │   ├── unnecessary-attribute.stderr
            │   ├── unsupported-property.rs
            │   ├── unsupported-property.stderr
            │   ├── wrong-context.rs
            │   └── wrong-context.stderr
            └── pass/
                ├── context-and-this.rs
                ├── globals.rs
                └── json.rs
Download .txt
SYMBOL INDEX (1851 symbols across 168 files)

FILE: bench/index.js
  function median (line 4) | function median(values) {
  function reportBencherDev (line 21) | function reportBencherDev(results) {
  function triple (line 52) | function triple(s, n, b) {

FILE: bench/src/lib.rs
  function export_noop (line 4) | fn export_noop() {}
  function manual_noop (line 6) | fn manual_noop(mut cx: FunctionContext) -> JsResult<JsUndefined> {
  function hello (line 10) | fn hello(mut cx: FunctionContext) -> JsResult<JsString> {
  function call_callback_with_call (line 14) | fn call_callback_with_call(mut cx: FunctionContext) -> JsResult<JsValue> {
  function call_callback_with_call_with (line 24) | fn call_callback_with_call_with(mut cx: FunctionContext) -> JsResult<JsV...
  function call_callback_with_bind (line 34) | fn call_callback_with_bind(mut cx: FunctionContext) -> JsResult<JsValue> {
  function main (line 46) | fn main(mut cx: ModuleContext) -> NeonResult<()> {

FILE: crates/neon-macros/src/class/meta.rs
  type Meta (line 2) | pub(crate) struct Meta {
  type Kind (line 11) | pub(super) enum Kind {
  type PropertyMeta (line 21) | pub(crate) struct PropertyMeta {
  type PropertyParser (line 26) | pub(crate) struct PropertyParser;
    type Output (line 29) | type Output = PropertyMeta;
    method parse2 (line 31) | fn parse2(self, tokens: proc_macro2::TokenStream) -> syn::Result<Self:...
  type Parser (line 63) | pub(crate) struct Parser(pub(crate) Meta);
    type Output (line 66) | type Output = Meta;
    method parse2 (line 68) | fn parse2(self, tokens: proc_macro2::TokenStream) -> syn::Result<Self:...

FILE: crates/neon-macros/src/class/mod.rs
  type ClassItems (line 7) | struct ClassItems {
  function is_receiver_mutable (line 15) | fn is_receiver_mutable(sig: &syn::Signature) -> bool {
  type ParamKind (line 24) | enum ParamKind {
    method from_type (line 31) | fn from_type(ty: &syn::Type) -> Self {
  function extract_param_types (line 51) | fn extract_param_types(sig: &syn::Signature, has_context: bool, has_this...
  function generate_method_wrapper (line 64) | fn generate_method_wrapper(
  function context_parse (line 356) | fn context_parse(
  function check_context (line 381) | fn check_context(opts: &meta::Meta, sig: &syn::Signature) -> syn::Result...
  function check_channel (line 434) | fn check_channel(opts: &meta::Meta, sig: &syn::Signature) -> syn::Result...
  function first_arg (line 471) | fn first_arg<'a>(
  function is_context_type (line 500) | fn is_context_type(ty: &syn::Type) -> bool {
  function is_channel_type (line 509) | fn is_channel_type(ty: &syn::Type) -> bool {
  function type_path_ident (line 519) | fn type_path_ident(ty: &syn::Type) -> Option<&syn::Ident> {
  function validate_method_attributes (line 529) | fn validate_method_attributes(meta: &meta::Meta, sig: &syn::Signature) -...
  function check_this (line 618) | fn check_this(opts: &meta::Meta, sig: &syn::Signature, has_context: bool...
  function check_constructor_context (line 663) | fn check_constructor_context(opts: &meta::Meta, sig: &syn::Signature) ->...
  function generate_constructor_wrapper (line 712) | fn generate_constructor_wrapper(
  function group_class_items (line 775) | fn group_class_items(items: Vec<syn::ImplItem>) -> Result<ClassItems, sy...
  function class (line 821) | pub(crate) fn class(
  function class_with_name (line 828) | pub(crate) fn class_with_name(

FILE: crates/neon-macros/src/export/class.rs
  function export (line 7) | pub(super) fn export(meta: meta::Meta, input: syn::ItemImpl) -> proc_mac...
  function extract_class_ident (line 78) | fn extract_class_ident(input: &syn::ItemImpl) -> syn::Result<syn::Ident> {

FILE: crates/neon-macros/src/export/class/meta.rs
  type Meta (line 5) | pub(crate) struct Meta {
  method parse (line 13) | fn parse(input: ParseStream) -> syn::Result<Self> {
  type Parser (line 87) | pub(crate) struct Parser;
    type Output (line 90) | type Output = Meta;
    method parse2 (line 92) | fn parse2(self, tokens: proc_macro2::TokenStream) -> syn::Result<Self:...

FILE: crates/neon-macros/src/export/function/meta.rs
  type Meta (line 2) | pub(crate) struct Meta {
    method set_name (line 20) | fn set_name(&mut self, meta: syn::meta::ParseNestedMeta) -> syn::Resul...
    method force_json (line 26) | fn force_json(&mut self, _meta: syn::meta::ParseNestedMeta) -> syn::Re...
    method force_context (line 32) | fn force_context(&mut self, _meta: syn::meta::ParseNestedMeta) -> syn:...
    method force_this (line 38) | fn force_this(&mut self, _meta: syn::meta::ParseNestedMeta) -> syn::Re...
    method make_async (line 44) | fn make_async(&mut self, meta: syn::meta::ParseNestedMeta) -> syn::Res...
    method make_task (line 54) | fn make_task(&mut self, _meta: syn::meta::ParseNestedMeta) -> syn::Res...
  type Kind (line 11) | pub(super) enum Kind {
  type Parser (line 61) | pub(crate) struct Parser(syn::ItemFn);
    method new (line 64) | pub(crate) fn new(item: syn::ItemFn) -> Self {
    type Output (line 70) | type Output = (syn::ItemFn, Meta);
    method parse2 (line 72) | fn parse2(self, tokens: proc_macro2::TokenStream) -> syn::Result<Self:...

FILE: crates/neon-macros/src/export/function/mod.rs
  function export (line 7) | pub(super) fn export(meta: meta::Meta, input: syn::ItemFn) -> proc_macro...
  function count_args (line 154) | fn count_args(sig: &syn::Signature, has_context: bool, has_this: bool) -...
  function context_parse (line 165) | fn context_parse(
  function check_context (line 194) | fn check_context(opts: &meta::Meta, sig: &syn::Signature) -> syn::Result...
  function check_channel (line 252) | fn check_channel(opts: &meta::Meta, sig: &syn::Signature) -> syn::Result...
  function first_arg (line 289) | fn first_arg<'a>(
  function is_context_type (line 318) | fn is_context_type(ty: &syn::Type) -> bool {
  function is_channel_type (line 327) | fn is_channel_type(ty: &syn::Type) -> bool {
  function type_path_ident (line 337) | fn type_path_ident(ty: &syn::Type) -> Option<&syn::Ident> {
  function check_this (line 348) | fn check_this(opts: &meta::Meta, sig: &syn::Signature, has_context: bool...

FILE: crates/neon-macros/src/export/global/meta.rs
  type Meta (line 2) | pub(crate) struct Meta {
  type Parser (line 7) | pub(crate) struct Parser;
    type Output (line 10) | type Output = Meta;
    method parse2 (line 12) | fn parse2(self, tokens: proc_macro2::TokenStream) -> syn::Result<Self:...

FILE: crates/neon-macros/src/export/global/mod.rs
  function export (line 4) | pub(super) fn export(meta: meta::Meta, name: &syn::Ident, expr: Box<syn:...

FILE: crates/neon-macros/src/export/mod.rs
  function export (line 7) | pub(crate) fn export(
  function unsupported (line 54) | fn unsupported(item: syn::Item) -> proc_macro::TokenStream {

FILE: crates/neon-macros/src/lib.rs
  function main (line 8) | pub fn main(
  function export (line 40) | pub fn export(
  function class (line 48) | pub fn class(

FILE: crates/neon-macros/src/name.rs
  function to_camel_case (line 8) | pub(crate) fn to_camel_case(name: &str) -> String {
  function is_valid_js_identifier (line 57) | pub(crate) fn is_valid_js_identifier(name: &str) -> bool {
  function to_camel_case (line 130) | fn to_camel_case() {

FILE: crates/neon/src/context/internal.rs
  type Env (line 13) | pub struct Env(raw::Env);
    method from (line 16) | fn from(env: raw::Env) -> Self {
    method to_raw (line 27) | pub(crate) fn to_raw(self) -> raw::Env {
    method try_catch (line 32) | pub(super) unsafe fn try_catch<T, F>(self, f: F) -> Result<T, raw::Local>
  type ContextInternal (line 49) | pub trait ContextInternal<'cx>: Sized {
    method cx (line 50) | fn cx(&self) -> &Cx<'cx>;
    method cx_mut (line 51) | fn cx_mut(&mut self) -> &mut Cx<'cx>;
    method env (line 52) | fn env(&self) -> Env {
  function default_main (line 57) | fn default_main(mut cx: ModuleContext) -> NeonResult<()> {
  function init (line 63) | fn init(cx: ModuleContext) -> NeonResult<()> {
  function napi_register_module_v1 (line 76) | unsafe extern "C" fn napi_register_module_v1(env: *mut c_void, m: *mut c...

FILE: crates/neon/src/context/mod.rs
  type TaskContext (line 205) | pub type TaskContext<'cx> = Cx<'cx>;
  type ExecuteContext (line 209) | pub type ExecuteContext<'cx> = Cx<'cx>;
  type ComputeContext (line 213) | pub type ComputeContext<'cx> = Cx<'cx>;
  type FinalizeContext (line 217) | pub type FinalizeContext<'cx> = Cx<'cx>;
  type SysContext (line 223) | pub type SysContext<'cx> = Cx<'cx>;
  type Cx (line 226) | pub struct Cx<'cx> {
  function from_raw (line 241) | pub unsafe fn from_raw(env: sys::Env) -> Self {
  function new (line 248) | fn new(env: Env) -> Self {
  function with_context (line 255) | pub(crate) fn with_context<T, F: for<'b> FnOnce(Cx<'b>) -> T>(env: Env, ...
  function cx (line 264) | fn cx(&self) -> &Cx<'cx> {
  function cx_mut (line 268) | fn cx_mut(&mut self) -> &mut Cx<'cx> {
  function from (line 276) | fn from(cx: FunctionContext<'cx>) -> Self {
  function from (line 282) | fn from(cx: ModuleContext<'cx>) -> Self {
  type CallbackInfo (line 288) | pub(crate) struct CallbackInfo<'cx> {
  function new (line 294) | pub unsafe fn new(info: raw::FunctionCallbackInfo) -> Self {
  function kind (line 301) | fn kind<'b, C: Context<'b>>(&self, cx: &C) -> CallKind {
  function len (line 309) | pub fn len<'b, C: Context<'b>>(&self, cx: &C) -> usize {
  function argv (line 313) | pub fn argv<'b, C: Context<'b>>(&self, cx: &mut C) -> sys::call::Argumen...
  function this (line 317) | pub fn this<'b, C: Context<'b>>(&self, cx: &mut C) -> raw::Local {
  function argv_exact (line 326) | pub(crate) fn argv_exact<'b, C: Context<'b>, const N: usize>(
  type CallKind (line 357) | pub enum CallKind {
  type Context (line 367) | pub trait Context<'a>: ContextInternal<'a> {
    method lock (line 371) | fn lock<'b>(&'b mut self) -> Lock<'b, Self>
    method execute_scoped (line 383) | fn execute_scoped<'b, T, F>(&mut self, f: F) -> T
    method compute_scoped (line 402) | fn compute_scoped<'b, V, F>(&mut self, f: F) -> JsResult<'a, V>
    method try_catch (line 419) | fn try_catch<T, F>(&mut self, f: F) -> Result<T, Handle<'a, JsValue>>
    method boolean (line 431) | fn boolean(&mut self, b: bool) -> Handle<'a, JsBoolean> {
    method number (line 436) | fn number<T: Into<f64>>(&mut self, x: T) -> Handle<'a, JsNumber> {
    method string (line 443) | fn string<S: AsRef<str>>(&mut self, s: S) -> Handle<'a, JsString> {
    method try_string (line 450) | fn try_string<S: AsRef<str>>(&mut self, s: S) -> StringResult<'a> {
    method null (line 455) | fn null(&mut self) -> Handle<'a, JsNull> {
    method undefined (line 460) | fn undefined(&mut self) -> Handle<'a, JsUndefined> {
    method empty_object (line 465) | fn empty_object(&mut self) -> Handle<'a, JsObject> {
    method empty_array (line 470) | fn empty_array(&mut self) -> Handle<'a, JsArray> {
    method array_buffer (line 475) | fn array_buffer(&mut self, size: usize) -> JsResult<'a, JsArrayBuffer> {
    method buffer (line 480) | fn buffer(&mut self, size: usize) -> JsResult<'a, JsBuffer> {
    method date (line 486) | fn date(&mut self, value: impl Into<f64>) -> Result<Handle<'a, JsDate>...
    method global (line 507) | fn global<T: Value>(&mut self, name: &str) -> JsResult<'a, T> {
    method global_object (line 513) | fn global_object(&mut self) -> Handle<'a, JsObject> {
    method throw (line 520) | fn throw<T: Value, U>(&mut self, v: Handle<T>) -> NeonResult<U> {
    method error (line 528) | fn error<S: AsRef<str>>(&mut self, msg: S) -> JsResult<'a, JsError> {
    method type_error (line 533) | fn type_error<S: AsRef<str>>(&mut self, msg: S) -> JsResult<'a, JsErro...
    method range_error (line 538) | fn range_error<S: AsRef<str>>(&mut self, msg: S) -> JsResult<'a, JsErr...
    method throw_error (line 543) | fn throw_error<S: AsRef<str>, T>(&mut self, msg: S) -> NeonResult<T> {
    method throw_type_error (line 549) | fn throw_type_error<S: AsRef<str>, T>(&mut self, msg: S) -> NeonResult...
    method throw_range_error (line 555) | fn throw_range_error<S: AsRef<str>, T>(&mut self, msg: S) -> NeonResul...
    method boxed (line 576) | fn boxed<U: Finalize + 'static>(&mut self, v: U) -> Handle<'a, JsBox<U...
    method queue (line 583) | fn queue(&mut self) -> Channel {
    method channel (line 593) | fn channel(&mut self) -> Channel {
    method promise (line 617) | fn promise(&mut self) -> (Deferred, Handle<'a, JsPromise>) {
    method task (line 637) | fn task<'cx, O, E>(&'cx mut self, execute: E) -> TaskBuilder<'cx, Self...
    method to_raw (line 649) | fn to_raw(&self) -> sys::Env {
  type ModuleContext (line 655) | pub struct ModuleContext<'cx> {
  type Target (line 661) | type Target = Cx<'cx>;
  method deref (line 663) | fn deref(&self) -> &Self::Target {
  method deref_mut (line 669) | fn deref_mut(&mut self) -> &mut Self::Target {
  function with (line 677) | pub(crate) fn with<T, F: for<'b> FnOnce(ModuleContext<'b>) -> T>(
  function export_function (line 690) | pub fn export_function<T: Value>(
  function export_function (line 702) | pub fn export_function<F, V>(&mut self, key: &str, f: F) -> NeonResult<()>
  function export_value (line 715) | pub fn export_value<T: Value>(&mut self, key: &str, val: Handle<T>) -> N...
  function exports_object (line 721) | pub fn exports_object(&mut self) -> JsResult<'cx, JsObject> {
  function cx (line 727) | fn cx(&self) -> &Cx<'cx> {
  function cx_mut (line 731) | fn cx_mut(&mut self) -> &mut Cx<'cx> {
  type FunctionContext (line 741) | pub struct FunctionContext<'cx> {
  type Target (line 749) | type Target = Cx<'cx>;
  method deref (line 751) | fn deref(&self) -> &Self::Target {
  method deref_mut (line 757) | fn deref_mut(&mut self) -> &mut Self::Target {
  function kind (line 766) | pub fn kind(&self) -> CallKind {
  function with (line 770) | pub(crate) fn with<U, F: for<'b> FnOnce(FunctionContext<'b>) -> U>(
  function len (line 783) | pub fn len(&self) -> usize {
  function is_empty (line 788) | pub fn is_empty(&self) -> bool {
  function argument_opt (line 793) | pub fn argument_opt(&mut self, i: usize) -> Option<Handle<'cx, JsValue>> {
  function argument (line 806) | pub fn argument<V: Value>(&mut self, i: usize) -> JsResult<'cx, V> {
  function this (line 817) | pub fn this<T: Value>(&mut self) -> JsResult<'cx, T> {
  function this_value (line 822) | pub fn this_value(&mut self) -> Handle<'cx, JsValue> {
  function args (line 840) | pub fn args<T>(&mut self) -> NeonResult<T>
  function arg (line 848) | pub fn arg<T>(&mut self) -> NeonResult<T>
  function args_opt (line 872) | pub fn args_opt<T>(&mut self) -> NeonResult<Option<T>>
  function arg_opt (line 880) | pub fn arg_opt<T>(&mut self) -> NeonResult<Option<T>>
  function argv (line 887) | pub(crate) fn argv<const N: usize>(&mut self) -> [Handle<'cx, JsValue>; ...
  function cx (line 893) | fn cx(&self) -> &Cx<'cx> {
  function cx_mut (line 897) | fn cx_mut(&mut self) -> &mut Cx<'cx> {

FILE: crates/neon/src/event/channel.rs
  type Receiver (line 32) | pub(super) struct Receiver<T>(mpsc::Receiver<T>);
  function blocking_recv (line 35) | pub(super) fn blocking_recv(self) -> Result<T, mpsc::RecvError> {
  function channel (line 40) | pub(super) fn channel<T>() -> (mpsc::SyncSender<T>, Receiver<T>) {
  type Callback (line 47) | type Callback = Box<dyn FnOnce(sys::Env) + Send + 'static>;
  type Channel (line 92) | pub struct Channel {
    method fmt (line 98) | fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
    method new (line 106) | pub fn new<'a, C: Context<'a>>(cx: &mut C) -> Self {
    method unref (line 115) | pub fn unref<'a, C: Context<'a>>(&mut self, cx: &mut C) -> &mut Self {
    method reference (line 128) | pub fn reference<'a, C: Context<'a>>(&mut self, cx: &mut C) -> &mut Se...
    method send (line 141) | pub fn send<T, F>(&self, f: F) -> JoinHandle<T>
    method try_send (line 153) | pub fn try_send<T, F>(&self, f: F) -> Result<JoinHandle<T>, SendError>
    method has_ref (line 180) | pub fn has_ref(&self) -> bool {
  method clone (line 195) | fn clone(&self) -> Self {
  method drop (line 217) | fn drop(&mut self) {
  type JoinHandle (line 252) | pub struct JoinHandle<T> {
  function join (line 265) | pub fn join(self) -> Result<T, JoinError> {
  type Output (line 273) | type Output = Result<T, JoinError>;
  method poll (line 275) | fn poll(mut self: Pin<&mut Self>, cx: &mut task::Context) -> Poll<Self::...
  type JoinError (line 294) | pub struct JoinError(JoinErrorType);
    method as_str (line 303) | fn as_str(&self) -> &str {
    method fmt (line 312) | fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
    method from (line 320) | fn from(_: oneshot::error::RecvError) -> Self {
    method from (line 329) | fn from(_: SendThrow) -> Self {
  type JoinErrorType (line 297) | enum JoinErrorType {
  type SendThrow (line 326) | pub(crate) struct SendThrow(());
    method from (line 335) | fn from(_: Throw) -> SendThrow {
  function or_throw (line 341) | fn or_throw<'a, C: Context<'a>>(self, cx: &mut C) -> NeonResult<T> {
  type SendError (line 355) | pub struct SendError;
    method fmt (line 358) | fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
    method fmt (line 364) | fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
  type ChannelState (line 371) | struct ChannelState {
    method new (line 377) | fn new<'a, C: Context<'a>>(cx: &mut C) -> Self {
    method reference (line 385) | fn reference<'a, C: Context<'a>>(&self, cx: &mut C) {
    method unref (line 397) | fn unref<'a, C: Context<'a>>(&self, cx: &mut C) {
    method callback (line 410) | fn callback(env: Option<sys::Env>, callback: Callback) {

FILE: crates/neon/src/event/mod.rs
  type EventQueue (line 137) | pub type EventQueue = self::channel::Channel;
  type EventQueueError (line 142) | pub type EventQueueError = self::channel::SendError;

FILE: crates/neon/src/event/task.rs
  type TaskBuilder (line 25) | pub struct TaskBuilder<'cx, C, E> {
  function new (line 38) | pub fn new(cx: &'cx mut C, execute: E) -> Self {
  function and_then (line 45) | pub fn and_then<F>(self, complete: F)
  function promise (line 61) | pub fn promise<V, F>(self, complete: F) -> Handle<'a, JsPromise>
  function schedule (line 77) | fn schedule<I, O, D>(env: Env, input: I, data: D)
  function execute (line 88) | fn execute<I, O>(input: I) -> O
  function complete (line 96) | fn complete<O, D>(env: raw::Env, output: thread::Result<O>, callback: D)
  function schedule_promise (line 113) | fn schedule_promise<I, O, D, V>(env: Env, input: I, complete: D, deferre...
  function complete_promise (line 131) | fn complete_promise<O, D, V>(

FILE: crates/neon/src/executor/mod.rs
  type BoxFuture (line 8) | type BoxFuture = Pin<Box<dyn Future<Output = ()> + Send + 'static>>;
  type Runtime (line 12) | pub trait Runtime: Send + Sync + 'static {
    method spawn (line 13) | fn spawn(&self, fut: BoxFuture);
  function set_global_executor (line 50) | pub fn set_global_executor<R>(cx: &mut Cx, runtime: R) -> Result<(), R>

FILE: crates/neon/src/executor/tokio.rs
  method spawn (line 6) | fn spawn(&self, fut: BoxFuture) {
  method spawn (line 12) | fn spawn(&self, fut: BoxFuture) {
  method spawn (line 18) | fn spawn(&self, fut: BoxFuture) {
  method spawn (line 24) | fn spawn(&self, fut: BoxFuture) {
  method spawn (line 30) | fn spawn(&self, fut: BoxFuture) {
  function spawn (line 35) | fn spawn(handle: &tokio::runtime::Handle, fut: BoxFuture) {
  function init (line 41) | pub(crate) fn init(cx: &mut crate::context::ModuleContext) -> crate::res...

FILE: crates/neon/src/handle/internal.rs
  type SuperType (line 5) | pub trait SuperType<T: Value> {
    method upcast_internal (line 6) | fn upcast_internal(v: &T) -> Self;
  type TransparentNoCopyWrapper (line 15) | pub unsafe trait TransparentNoCopyWrapper: Sized {
    method into_inner (line 20) | fn into_inner(self) -> Self::Inner;
    method wrap_ref (line 22) | fn wrap_ref(s: &Self::Inner) -> &Self {
    method wrap_mut (line 26) | fn wrap_mut(s: &mut Self::Inner) -> &mut Self {

FILE: crates/neon/src/handle/mod.rs
  type Handle (line 70) | pub struct Handle<'a, V: Value + 'a> {
  method clone (line 78) | fn clone(&self) -> Self {
  function new_internal (line 86) | pub(crate) fn new_internal(value: V) -> Handle<'a, V> {
  type DowncastError (line 96) | pub struct DowncastError<F: Value, T: Value> {
  method fmt (line 102) | fn fmt(&self, f: &mut fmt::Formatter) -> Result<(), fmt::Error> {
  function new (line 108) | fn new() -> Self {
  method fmt (line 117) | fn fmt(&self, f: &mut fmt::Formatter) -> Result<(), fmt::Error> {
  type DowncastResult (line 125) | pub type DowncastResult<'a, F, T> = Result<Handle<'a, T>, DowncastError<...
  function or_throw (line 128) | fn or_throw<'b, C: Context<'b>>(self, cx: &mut C) -> JsResult<'a, T> {
  function upcast (line 140) | pub fn upcast<U: Value + SuperType<T>>(&self) -> Handle<'a, U> {
  function is_a (line 158) | pub fn is_a<'b, U: Value, C: Context<'b>>(&self, cx: &mut C) -> bool {
  function downcast (line 166) | pub fn downcast<'b, U: Value, C: Context<'b>>(&self, cx: &mut C) -> Down...
  function downcast_or_throw (line 176) | pub fn downcast_or_throw<'b, U: Value, C: Context<'b>>(&self, cx: &mut C...
  function strict_equals (line 180) | pub fn strict_equals<'b, U: Value, C: Context<'b>>(
  type Target (line 190) | type Target = V;
  method deref (line 191) | fn deref(&self) -> &V {
  method deref_mut (line 197) | fn deref_mut(&mut self) -> &mut V {

FILE: crates/neon/src/handle/root.rs
  type InstanceId (line 24) | type InstanceId = ThreadId;
  type NapiRef (line 28) | pub(crate) struct NapiRef(*mut c_void);
    method unref (line 33) | pub(crate) unsafe fn unref(self, env: raw::Env) {
  type Root (line 52) | pub struct Root<T> {
  function fmt (line 63) | fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
  function instance_id (line 76) | fn instance_id<'a, C: Context<'a>>(cx: &mut C) -> InstanceId {
  function instance_id (line 81) | fn instance_id<'a, C: Context<'a>>(_: &mut C) -> InstanceId {
  function new (line 95) | pub fn new<'a, C: Context<'a>>(cx: &mut C, value: &T) -> Self {
  function clone (line 120) | pub fn clone<'a, C: Context<'a>>(&self, cx: &mut C) -> Self {
  function drop (line 139) | pub fn drop<'a, C: Context<'a>>(self, cx: &mut C) {
  function into_inner (line 153) | pub fn into_inner<'a, C: Context<'a>>(self, cx: &mut C) -> Handle<'a, T> {
  function to_inner (line 173) | pub fn to_inner<'a, C: Context<'a>>(&self, cx: &mut C) -> Handle<'a, T> {
  function as_napi_ref (line 180) | fn as_napi_ref<'a, C: Context<'a>>(&self, cx: &mut C) -> &NapiRef {
  function into_napi_ref (line 192) | fn into_napi_ref<'a, C: Context<'a>>(mut self, cx: &mut C) -> NapiRef {
  method finalize (line 203) | fn finalize<'a, C: Context<'a>>(self, cx: &mut C) {
  method drop (line 210) | fn drop(&mut self) {
  method drop (line 230) | fn drop(&mut self) {

FILE: crates/neon/src/lib.rs
  type Exports (line 147) | pub struct Exports(());
    method export (line 180) | pub fn export(self, cx: &mut ModuleContext) -> NeonResult<()> {
  type Item (line 192) | type Item = <<Self as IntoIterator>::IntoIter as IntoIterator>::Item;
  type IntoIter (line 193) | type IntoIter = std::slice::Iter<
  method into_iter (line 198) | fn into_iter(self) -> Self::IntoIter {
  function registered (line 204) | pub fn registered() -> Exports {
  function feature_matrix (line 209) | fn feature_matrix() {

FILE: crates/neon/src/lifecycle.rs
  type InstanceId (line 34) | pub(crate) struct InstanceId(u32);
    method next (line 37) | fn next() -> Self {
  type InstanceData (line 51) | pub(crate) struct InstanceData {
    method get (line 243) | pub(crate) fn get<'cx, C: Context<'cx>>(cx: &mut C) -> &mut InstanceDa...
    method drop_queue (line 274) | pub(crate) fn drop_queue<'cx, C: Context<'cx>>(
    method channel (line 282) | pub(crate) fn channel<'cx, C: Context<'cx>>(cx: &mut C) -> Channel {
    method id (line 289) | pub(crate) fn id<'cx, C: Context<'cx>>(cx: &mut C) -> InstanceId {
    method locals (line 294) | pub(crate) fn locals<'cx, C: Context<'cx>>(cx: &mut C) -> &mut LocalTa...
  type LocalTable (line 71) | pub(crate) struct LocalTable {
    method get (line 153) | pub(crate) fn get(&mut self, index: usize) -> &mut LocalCell {
  type LocalCellValue (line 75) | pub(crate) type LocalCellValue = Box<dyn Any + Send + 'static>;
  type LocalCell (line 78) | pub(crate) enum LocalCell {
    method pre_init (line 92) | fn pre_init<F>(&mut self, f: F)
    method get (line 105) | pub(crate) fn get<'cx, 'a, C>(cx: &'a mut C, id: usize) -> Option<&'a ...
    method get_or_init (line 116) | pub(crate) fn get_or_init<'cx, 'a, C, F>(
    method get_or_try_init (line 132) | pub(crate) fn get_or_try_init<'cx, 'a, C, E, F>(
  type TryInitTransaction (line 168) | struct TryInitTransaction<'cx, 'a, C: Context<'cx>> {
  function new (line 175) | fn new(cx: &'a mut C, id: usize) -> Self {
  function run (line 187) | fn run<E, F>(&mut self, f: F) -> Result<(), E>
  function cell (line 198) | fn cell(&mut self) -> &mut LocalCell {
  function is_trying (line 203) | fn is_trying(&mut self) -> bool {
  method drop (line 209) | fn drop(&mut self) {
  type DropData (line 217) | pub(crate) enum DropData {
    method drop (line 224) | fn drop(env: Option<Env>, data: Self) {

FILE: crates/neon/src/macro_internal/futures.rs
  function spawn (line 9) | pub fn spawn<'cx, F, S>(cx: &mut Cx<'cx>, fut: F, settle: S) -> JsResult...

FILE: crates/neon/src/macro_internal/mod.rs
  type Export (line 27) | type Export<'cx> = (&'static str, Handle<'cx, JsValue>);
  type NeonMarker (line 36) | pub struct NeonMarker<Tag, Return>(PhantomData<Tag>, PhantomData<Return>);
  type NeonJsonTag (line 40) | pub struct NeonJsonTag;
  type NeonValueTag (line 41) | pub struct NeonValueTag;
  type NeonResultTag (line 42) | pub struct NeonResultTag;
  type ToNeonMarker (line 44) | pub trait ToNeonMarker {
    method to_neon_marker (line 47) | fn to_neon_marker<Tag>(&self) -> NeonMarker<Tag, Self::Return>;
    type Return (line 52) | type Return = NeonResultTag;
    method to_neon_marker (line 54) | fn to_neon_marker<Tag>(&self) -> NeonMarker<Tag, Self::Return> {
    type Return (line 61) | type Return = NeonValueTag;
    method to_neon_marker (line 63) | fn to_neon_marker<Tag>(&self) -> NeonMarker<Tag, Self::Return> {
  function neon_into_js (line 69) | pub fn neon_into_js<'cx, T>(self, cx: &mut Cx<'cx>, v: T) -> JsResult<'c...
  function neon_into_js (line 79) | pub fn neon_into_js<'cx, T>(self, cx: &mut Cx<'cx>, v: T) -> JsResult<'c...
  function neon_into_js (line 89) | pub fn neon_into_js<'cx, T, E>(
  function into_neon_result (line 102) | pub fn into_neon_result<T>(self, _cx: &mut Cx, v: T) -> NeonResult<T> {
  function into_neon_result (line 108) | pub fn into_neon_result<'cx, T, E>(self, cx: &mut Cx<'cx>, res: Result<T...
  function internal_constructor (line 135) | pub fn internal_constructor<'cx, T: crate::object::Class>(

FILE: crates/neon/src/meta.rs
  constant VERSION (line 6) | pub const VERSION: &str = env!("CARGO_PKG_VERSION");
  constant MAJOR (line 9) | pub const MAJOR: &str = env!("CARGO_PKG_VERSION_MAJOR");
  constant MINOR (line 12) | pub const MINOR: &str = env!("CARGO_PKG_VERSION_MINOR");
  constant PATCH (line 15) | pub const PATCH: &str = env!("CARGO_PKG_VERSION_PATCH");
  function version (line 18) | pub fn version() -> Version {

FILE: crates/neon/src/object/class.rs
  type ClassInternal (line 10) | pub trait ClassInternal {
    method local (line 11) | fn local<'cx>(cx: &mut Cx<'cx>) -> NeonResult<ClassMetadata<'cx>>;
    method create (line 12) | fn create<'cx>(cx: &mut Cx<'cx>) -> NeonResult<ClassMetadata<'cx>>;
  type Class (line 19) | pub trait Class: ClassInternal {
    method name (line 21) | fn name() -> String;
    method constructor (line 24) | fn constructor<'cx>(cx: &mut Cx<'cx>) -> JsResult<'cx, JsFunction>;
  type ClassMetadata (line 28) | pub struct ClassMetadata<'cx> {
  function new_class_metadata (line 33) | pub fn new_class_metadata<'cx>(
  function constructor (line 44) | pub fn constructor(&self) -> Handle<'cx, JsFunction> {
  function internal_constructor (line 48) | pub(crate) fn internal_constructor(&self) -> Handle<'cx, JsFunction> {
  function root (line 53) | pub fn root<'cx2>(&self, cx: &mut Cx<'cx2>) -> RootClassMetadata {
  type RootClassMetadata (line 62) | pub struct RootClassMetadata {
    method to_inner (line 71) | pub fn to_inner<'a, 'cx: 'a>(&'a self, cx: &'a mut Cx<'cx>) -> ClassMe...

FILE: crates/neon/src/object/mod.rs
  type PropertyKey (line 65) | pub trait PropertyKey: Copy {
    method get_from (line 66) | unsafe fn get_from<'c, C: Context<'c>>(
    method set_from (line 73) | unsafe fn set_from<'c, C: Context<'c>>(
    method get_from (line 83) | unsafe fn get_from<'c, C: Context<'c>>(
    method set_from (line 92) | unsafe fn set_from<'c, C: Context<'c>>(
    method get_from (line 104) | unsafe fn get_from<'c, C: Context<'c>>(
    method set_from (line 115) | unsafe fn set_from<'c, C: Context<'c>>(
    method get_from (line 129) | unsafe fn get_from<'c, C: Context<'c>>(
    method set_from (line 141) | unsafe fn set_from<'c, C: Context<'c>>(
  type PropOptions (line 174) | pub struct PropOptions<'a, 'cx, O, K>
  function this (line 192) | pub fn this(&self) -> Handle<'cx, O> {
  function prop (line 214) | pub fn prop(&mut self, key: K) -> &mut Self {
  function get (line 223) | pub fn get<R: TryFromJs<'cx>>(&mut self) -> NeonResult<R> {
  function set (line 231) | pub fn set<V: TryIntoJs<'cx>>(&mut self, v: V) -> NeonResult<&mut Self> {
  function set_with (line 240) | pub fn set_with<R, F>(&mut self, f: F) -> NeonResult<&mut Self>
  function bind (line 255) | pub fn bind(&'a mut self) -> NeonResult<BindOptions<'a, 'cx>> {
  type Object (line 268) | pub trait Object: Value {
    method prop (line 278) | fn prop<'a, 'cx: 'a, K: PropertyKey>(
    method method (line 293) | fn method<'a, 'cx: 'a, K: PropertyKey>(
    method get_opt (line 309) | fn get_opt<'a, V: Value, C: Context<'a>, K: PropertyKey>(
    method get_value (line 324) | fn get_value<'a, C: Context<'a>, K: PropertyKey>(
    method get (line 335) | fn get<'a, V: Value, C: Context<'a>, K: PropertyKey>(
    method get_own_property_names (line 345) | fn get_own_property_names<'a, C: Context<'a>>(&self, cx: &mut C) -> Js...
    method freeze (line 354) | fn freeze<'a, C: Context<'a>>(&self, cx: &mut C) -> NeonResult<&Self> {
    method seal (line 367) | fn seal<'a, C: Context<'a>>(&self, cx: &mut C) -> NeonResult<&Self> {
    method set (line 380) | fn set<'a, C: Context<'a>, K: PropertyKey, W: Value>(
    method root (line 396) | fn root<'a, C: Context<'a>>(&self, cx: &mut C) -> Root<Self> {
    method call_method_with (line 401) | fn call_method_with<'a, C, K>(&self, cx: &mut C, method: K) -> NeonRes...

FILE: crates/neon/src/object/wrap.rs
  type BoxAny (line 15) | type BoxAny = Box<dyn Any + 'static>;
  type WrapError (line 18) | pub struct WrapError(WrapErrorType);
    method object_expected (line 21) | fn object_expected() -> Self {
    method already_wrapped (line 25) | fn already_wrapped() -> Self {
    method not_wrapped (line 30) | fn not_wrapped() -> Self {
    method wrong_type (line 34) | fn wrong_type(expected: &'static str) -> Self {
    method foreign_type (line 39) | fn foreign_type() -> Self {
    method fmt (line 45) | fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
    type Value (line 55) | type Value = crate::types::JsError;
    method try_into_js (line 57) | fn try_into_js(self, cx: &mut Cx<'cx>) -> JsResult<'cx, Self::Value> {
  function or_throw (line 66) | fn or_throw<'cx, C>(self, cx: &mut C) -> NeonResult<T>
  type WrapErrorType (line 79) | enum WrapErrorType {
    method fmt (line 100) | fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
  function ref_cell_target_type_name (line 89) | fn ref_cell_target_type_name(s: &str) -> Option<String> {
  function wrap (line 117) | pub fn wrap<T, V>(cx: &mut Cx, o: Handle<V>, v: T) -> NeonResult<Result<...
  function unwrap (line 187) | pub fn unwrap<'cx, T, V>(cx: &mut Cx, o: Handle<'cx, V>) -> NeonResult<R...

FILE: crates/neon/src/reflect.rs
  function eval (line 10) | pub fn eval<'a, 'b, C: Context<'a>>(

FILE: crates/neon/src/result/mod.rs
  type Throw (line 51) | pub struct Throw(PhantomData<*mut ()>);
    method new (line 63) | pub unsafe fn new() -> Self {
    method new (line 68) | pub(crate) unsafe fn new() -> Self {
  method fmt (line 74) | fn fmt(&self, fmt: &mut Formatter) -> FmtResult {
  type NeonResult (line 80) | pub type NeonResult<T> = Result<T, Throw>;
  type JsResult (line 83) | pub type JsResult<'b, T> = NeonResult<Handle<'b, T>>;
  type ResultExt (line 87) | pub trait ResultExt<T> {
    method or_throw (line 88) | fn or_throw<'a, C: Context<'a>>(self, cx: &mut C) -> NeonResult<T>;
  function or_throw (line 96) | fn or_throw<'cx, C: Context<'cx>>(self, cx: &mut C) -> JsResult<'a, T> {

FILE: crates/neon/src/sys/array.rs
  function new (line 8) | pub unsafe fn new(out: &mut Local, env: Env, length: usize) {
  function len (line 17) | pub unsafe fn len(env: Env, array: Local) -> u32 {

FILE: crates/neon/src/sys/arraybuffer.rs
  function new (line 10) | pub unsafe fn new(env: Env, len: usize) -> Result<Local, napi::Status> {
  function new_external (line 23) | pub unsafe fn new_external<T>(env: Env, data: T) -> Local
  function drop_external (line 47) | unsafe extern "C" fn drop_external<T>(_env: Env, _data: *mut c_void, hin...
  function as_mut_slice (line 54) | pub unsafe fn as_mut_slice<'a>(env: Env, buf: Local) -> &'a mut [u8] {
  function size (line 69) | pub unsafe fn size(env: Env, buf: Local) -> usize {

FILE: crates/neon/src/sys/async_work.rs
  constant BOUNDARY (line 21) | const BOUNDARY: FailureBoundary = FailureBoundary {
  type Execute (line 27) | type Execute<I, O> = fn(input: I) -> O;
  type Complete (line 28) | type Complete<O, D> = fn(env: Env, output: thread::Result<O>, data: D);
  function schedule (line 36) | pub unsafe fn schedule<I, O, D>(
  type Data (line 84) | struct Data<I, O, D> {
  type State (line 93) | enum State<I, O> {
  function take_execute_input (line 104) | fn take_execute_input(&mut self) -> Option<I> {
  function into_output (line 112) | fn into_output(self) -> Option<thread::Result<O>> {
  function call_execute (line 125) | unsafe extern "C" fn call_execute<I, O, D>(_: Env, data: *mut c_void) {
  function call_complete (line 144) | unsafe extern "C" fn call_complete<I, O, D>(env: Env, status: napi::Stat...

FILE: crates/neon/src/sys/bindings/functions.rs
  function get_version (line 441) | unsafe fn get_version(host: &libloading::Library, env: Env) -> Result<u3...
  function load (line 450) | pub(crate) unsafe fn load(env: Env) -> Result<(), libloading::Error> {

FILE: crates/neon/src/sys/bindings/types.rs
  type Env__ (line 6) | pub struct Env__ {
  type Env (line 12) | pub type Env = *mut Env__;
  type Value__ (line 17) | pub struct Value__ {
  type Value (line 23) | pub type Value = *mut Value__;
  type CallbackInfo__ (line 28) | pub struct CallbackInfo__ {
  type CallbackInfo (line 34) | pub type CallbackInfo = *mut CallbackInfo__;
  type EscapableHandleScope__ (line 39) | pub struct EscapableHandleScope__ {
  type EscapableHandleScope (line 45) | pub type EscapableHandleScope = *mut EscapableHandleScope__;
  type HandleScope__ (line 50) | pub struct HandleScope__ {
  type HandleScope (line 56) | pub type HandleScope = *mut HandleScope__;
  type Ref__ (line 61) | pub struct Ref__ {
  type Ref (line 67) | pub type Ref = *mut Ref__;
  type ThreadsafeFunction__ (line 73) | pub struct ThreadsafeFunction__ {
  type ThreadsafeFunction (line 80) | pub type ThreadsafeFunction = *mut ThreadsafeFunction__;
  type Callback (line 84) | pub type Callback = Option<unsafe extern "C" fn(env: Env, info: Callback...
  type Finalize (line 88) | pub type Finalize =
  type ThreadsafeFunctionCallJs (line 94) | pub type ThreadsafeFunctionCallJs = Option<
  type Status (line 103) | pub enum Status {
  type ValueType (line 133) | pub enum ValueType {
  type TypedArrayType (line 151) | pub enum TypedArrayType {
  type KeyCollectionMode (line 171) | pub enum KeyCollectionMode {
  type KeyConversion (line 182) | pub enum KeyConversion {
  type ThreadsafeFunctionCallMode (line 193) | pub enum ThreadsafeFunctionCallMode {
  type ThreadsafeFunctionReleaseMode (line 204) | pub enum ThreadsafeFunctionReleaseMode {
  type KeyFilter (line 214) | pub struct KeyFilter(pub ::std::os::raw::c_uint);
    constant ALL_PROPERTIES (line 219) | pub const ALL_PROPERTIES: KeyFilter = KeyFilter(0);
    constant WRITABLE (line 220) | pub const WRITABLE: KeyFilter = KeyFilter(1);
    constant CONFIGURABLE (line 221) | pub const CONFIGURABLE: KeyFilter = KeyFilter(4);
    constant SKIP_STRINGS (line 222) | pub const SKIP_STRINGS: KeyFilter = KeyFilter(8);
    constant SKIP_SYMBOLS (line 223) | pub const SKIP_SYMBOLS: KeyFilter = KeyFilter(16);
    type Output (line 228) | type Output = Self;
    method bitor (line 230) | fn bitor(self, other: Self) -> Self {
    method bitor_assign (line 238) | fn bitor_assign(&mut self, rhs: KeyFilter) {
    type Output (line 245) | type Output = Self;
    method bitand (line 247) | fn bitand(self, other: Self) -> Self {
    method bitand_assign (line 255) | fn bitand_assign(&mut self, rhs: KeyFilter) {
  type AsyncWork__ (line 263) | pub struct AsyncWork__ {
  type AsyncWork (line 269) | pub type AsyncWork = *mut AsyncWork__;
  type AsyncExecuteCallback (line 273) | pub type AsyncExecuteCallback = Option<unsafe extern "C" fn(env: Env, da...
  type AsyncCompleteCallback (line 277) | pub type AsyncCompleteCallback =
  type Deferred__ (line 283) | pub struct Deferred__ {
  type Deferred (line 289) | pub type Deferred = *mut Deferred__;
  type TypeTag (line 296) | pub struct TypeTag {

FILE: crates/neon/src/sys/buffer.rs
  function new (line 10) | pub unsafe fn new(env: Env, len: usize) -> Result<Local, napi::Status> {
  function uninitialized (line 18) | pub unsafe fn uninitialized(env: Env, len: usize) -> Result<(Local, *mut...
  function new_external (line 32) | pub unsafe fn new_external<T>(env: Env, data: T) -> Local
  function drop_external (line 56) | unsafe extern "C" fn drop_external<T>(_env: Env, _data: *mut c_void, hin...
  function as_mut_slice (line 63) | pub unsafe fn as_mut_slice<'a>(env: Env, buf: Local) -> &'a mut [u8] {
  function size (line 78) | pub unsafe fn size(env: Env, buf: Local) -> usize {

FILE: crates/neon/src/sys/call.rs
  constant ARGV_SIZE (line 17) | const ARGV_SIZE: usize = 4;
  type Arguments (line 23) | pub struct Arguments(SmallVec<[Local; ARGV_SIZE]>);
    method get (line 28) | pub fn get(&self, i: usize) -> Option<Local> {
  function is_construct (line 33) | pub unsafe fn is_construct(env: Env, info: FunctionCallbackInfo) -> bool {
  function this (line 47) | pub unsafe fn this(env: Env, info: FunctionCallbackInfo, out: &mut Local) {
  function len (line 53) | pub unsafe fn len(env: Env, info: FunctionCallbackInfo) -> usize {
  function argv (line 68) | pub unsafe fn argv(env: Env, info: FunctionCallbackInfo) -> Arguments {

FILE: crates/neon/src/sys/convert.rs
  function to_string (line 6) | pub unsafe fn to_string(out: &mut Local, env: Env, value: Local) -> bool {

FILE: crates/neon/src/sys/date.rs
  function new_date (line 13) | pub unsafe fn new_date(env: Env, value: f64) -> Local {
  function value (line 25) | pub unsafe fn value(env: Env, p: Local) -> f64 {

FILE: crates/neon/src/sys/debug_send_wrapper.rs
  type DebugSendWrapper (line 11) | pub struct DebugSendWrapper<T>(send_wrapper::SendWrapper<T>);
  function new (line 14) | pub fn new(value: T) -> Self {
  function take (line 18) | pub fn take(self) -> T {
  type Target (line 24) | type Target = T;
  method deref (line 26) | fn deref(&self) -> &Self::Target {
  type DebugSendWrapper (line 37) | pub struct DebugSendWrapper<T>(T);
  function new (line 40) | pub fn new(value: T) -> Self {
  function take (line 44) | pub fn take(self) -> T {
  type Target (line 50) | type Target = T;
  method deref (line 52) | fn deref(&self) -> &Self::Target {

FILE: crates/neon/src/sys/error.rs
  function is_throwing (line 8) | pub unsafe fn is_throwing(env: Env) -> bool {
  function catch_error (line 16) | pub unsafe fn catch_error(env: Env, error: *mut Local) -> bool {
  function clear_exception (line 26) | pub unsafe fn clear_exception(env: Env) {
  function throw (line 38) | pub unsafe fn throw(env: Env, val: Local) {
  function new_error (line 42) | pub unsafe fn new_error(env: Env, out: &mut Local, msg: Local) {
  function new_type_error (line 49) | pub unsafe fn new_type_error(env: Env, out: &mut Local, msg: Local) {
  function new_range_error (line 56) | pub unsafe fn new_range_error(env: Env, out: &mut Local, msg: Local) {
  function throw_error_from_utf8 (line 63) | pub unsafe fn throw_error_from_utf8(env: Env, msg: *const u8, len: i32) {
  function fatal_error (line 75) | pub(super) unsafe fn fatal_error(message: &str) -> ! {

FILE: crates/neon/src/sys/external.rs
  function finalize_external (line 10) | extern "C" fn finalize_external<T: 'static>(
  function deref (line 31) | pub unsafe fn deref<T: 'static>(env: Env, local: Local) -> Option<*const...
  function create (line 60) | pub unsafe fn create<T: 'static>(env: Env, v: T, finalizer: fn(Env, T)) ...

FILE: crates/neon/src/sys/fun.rs
  function new (line 10) | pub unsafe fn new<F>(env: Env, name: &str, callback: F) -> Result<Local,...
  function call_boxed (line 66) | unsafe extern "C" fn call_boxed<F>(env: Env, info: napi::CallbackInfo) -...
  function construct (line 86) | pub unsafe fn construct(

FILE: crates/neon/src/sys/lifecycle.rs
  function set_instance_data (line 17) | pub unsafe fn set_instance_data<T: Send + 'static>(env: Env, data: T) ->...
  function get_instance_data (line 30) | pub unsafe fn get_instance_data<T: Send + 'static>(env: Env) -> *mut T {
  function drop_box (line 38) | unsafe extern "C" fn drop_box<T>(_env: Env, data: *mut c_void, _hint: *m...

FILE: crates/neon/src/sys/mem.rs
  function strict_equals (line 6) | pub unsafe fn strict_equals(env: Env, lhs: Local, rhs: Local) -> bool {

FILE: crates/neon/src/sys/mod.rs
  function string (line 112) | unsafe fn string(env: Env, s: impl AsRef<str>) -> raw::Local {
  function setup (line 136) | pub unsafe fn setup(env: Env) {

FILE: crates/neon/src/sys/no_panic.rs
  type Panic (line 26) | type Panic = Box<dyn Any + Send + 'static>;
  constant UNKNOWN_PANIC_MESSAGE (line 28) | const UNKNOWN_PANIC_MESSAGE: &str = "Unknown panic";
  type FailureBoundary (line 42) | pub struct FailureBoundary {
    method catch_failure (line 50) | pub unsafe fn catch_failure<F>(&self, env: Env, deferred: Option<napi:...
  function can_call_into_js (line 135) | fn can_call_into_js(env: Env) -> bool {
  function fatal_exception (line 142) | unsafe fn fatal_exception(env: Env, error: Local) {
  function create_error (line 157) | unsafe fn create_error(
  function resolve_deferred (line 180) | unsafe fn resolve_deferred(env: Env, deferred: napi::Deferred, value: Lo...
  function reject_deferred (line 187) | unsafe fn reject_deferred(env: Env, deferred: napi::Deferred, value: Loc...
  function catch_exception (line 194) | unsafe fn catch_exception(env: Env) -> Option<Local> {
  function error_from_message (line 209) | unsafe fn error_from_message(env: Env, msg: &str) -> Local {
  function error_from_panic (line 222) | unsafe fn error_from_panic(env: Env, panic: Panic) -> Local {
  function set_property (line 235) | unsafe fn set_property(env: Env, object: Local, key: &str, value: Local) {
  function panic_msg (line 244) | unsafe fn panic_msg(panic: &Panic) -> Option<&str> {
  function external_from_panic (line 254) | unsafe fn external_from_panic(env: Env, panic: Panic) -> Local {
  function finalize_panic (line 280) | extern "C" fn finalize_panic(_env: Env, data: *mut c_void, _hint: *mut c...
  function create_string (line 287) | unsafe fn create_string(env: Env, msg: &str) -> Local {
  function is_exception_pending (line 297) | unsafe fn is_exception_pending(env: Env) -> bool {

FILE: crates/neon/src/sys/object.rs
  function new (line 9) | pub unsafe fn new(out: &mut Local, env: Env) {
  function freeze (line 14) | pub unsafe fn freeze(env: Env, obj: Local) -> Result<(), napi::Status> {
  function seal (line 24) | pub unsafe fn seal(env: Env, obj: Local) -> Result<(), napi::Status> {
  function get_own_property_names (line 31) | pub unsafe fn get_own_property_names(out: &mut Local, env: Env, object: ...
  function get_index (line 52) | pub unsafe fn get_index(out: &mut Local, env: Env, object: Local, index:...
  function set_index (line 65) | pub unsafe fn set_index(out: &mut bool, env: Env, object: Local, index: ...
  function get_string (line 73) | pub unsafe fn get_string(
  function set_string (line 104) | pub unsafe fn set_string(
  function get (line 137) | pub unsafe fn get(out: &mut Local, env: Env, object: Local, key: Local) ...
  function set (line 149) | pub unsafe fn set(out: &mut bool, env: Env, object: Local, key: Local, v...

FILE: crates/neon/src/sys/primitive.rs
  function undefined (line 7) | pub unsafe fn undefined(out: &mut Local, env: Env) {
  function null (line 12) | pub unsafe fn null(out: &mut Local, env: Env) {
  function boolean (line 17) | pub unsafe fn boolean(out: &mut Local, env: Env, b: bool) {
  function boolean_value (line 23) | pub unsafe fn boolean_value(env: Env, p: Local) -> bool {
  function number (line 34) | pub unsafe fn number(out: &mut Local, env: Env, v: f64) {
  function number_value (line 40) | pub unsafe fn number_value(env: Env, p: Local) -> f64 {

FILE: crates/neon/src/sys/promise.rs
  function create (line 14) | pub unsafe fn create(env: Env) -> (napi::Deferred, napi::Value) {
  function resolve (line 28) | pub unsafe fn resolve(env: Env, deferred: napi::Deferred, resolution: na...
  function reject (line 37) | pub unsafe fn reject(env: Env, deferred: napi::Deferred, rejection: napi...
  function reject_err_message (line 46) | pub unsafe fn reject_err_message(env: Env, deferred: napi::Deferred, msg...

FILE: crates/neon/src/sys/raw.rs
  type Local (line 3) | pub type Local = napi::Value;
  type FunctionCallbackInfo (line 5) | pub type FunctionCallbackInfo = napi::CallbackInfo;
  type Env (line 7) | pub type Env = napi::Env;

FILE: crates/neon/src/sys/reference.rs
  function new (line 8) | pub unsafe fn new(env: Env, value: Local) -> napi::Ref {
  function reference (line 18) | pub unsafe fn reference(env: Env, value: napi::Ref) -> usize {
  function unreference (line 28) | pub unsafe fn unreference(env: Env, value: napi::Ref) {
  function get (line 40) | pub unsafe fn get(env: Env, value: napi::Ref) -> Local {

FILE: crates/neon/src/sys/scope.rs
  type HandleScope (line 8) | pub(crate) struct HandleScope {
    method new (line 14) | pub(crate) unsafe fn new(env: Env) -> Self {
  method drop (line 27) | fn drop(&mut self) {
  type EscapableHandleScope (line 36) | pub(crate) struct EscapableHandleScope {
    method new (line 42) | pub(crate) unsafe fn new(env: Env) -> Self {
    method escape (line 53) | pub(crate) unsafe fn escape(&self, value: napi::Value) -> napi::Value {
  method drop (line 63) | fn drop(&mut self) {
  function get_global (line 72) | pub unsafe fn get_global(env: Env, out: &mut Local) {

FILE: crates/neon/src/sys/string.rs
  function new (line 8) | pub unsafe fn new(out: &mut Local, env: Env, data: *const u8, len: i32) ...
  function utf8_len (line 14) | pub unsafe fn utf8_len(env: Env, value: Local) -> usize {
  function data (line 21) | pub unsafe fn data(env: Env, out: *mut u8, len: usize, value: Local) -> ...
  function utf16_len (line 29) | pub unsafe fn utf16_len(env: Env, value: Local) -> usize {
  function data_utf16 (line 37) | pub unsafe fn data_utf16(env: Env, out: *mut u16, len: usize, value: Loc...
  function run_script (line 44) | pub unsafe fn run_script(out: &mut Local, env: Env, value: Local) -> bool {

FILE: crates/neon/src/sys/tag.rs
  function is_type (line 7) | unsafe fn is_type(env: Env, val: Local, expect: napi::ValueType) -> bool {
  function is_undefined (line 13) | pub unsafe fn is_undefined(env: Env, val: Local) -> bool {
  function is_null (line 17) | pub unsafe fn is_null(env: Env, val: Local) -> bool {
  function is_number (line 22) | pub unsafe fn is_number(env: Env, val: Local) -> bool {
  function is_boolean (line 27) | pub unsafe fn is_boolean(env: Env, val: Local) -> bool {
  function is_string (line 32) | pub unsafe fn is_string(env: Env, val: Local) -> bool {
  function is_object (line 36) | pub unsafe fn is_object(env: Env, val: Local) -> bool {
  function is_array (line 40) | pub unsafe fn is_array(env: Env, val: Local) -> bool {
  function is_function (line 46) | pub unsafe fn is_function(env: Env, val: Local) -> bool {
  function is_error (line 50) | pub unsafe fn is_error(env: Env, val: Local) -> bool {
  function is_buffer (line 57) | pub unsafe fn is_buffer(env: Env, val: Local) -> bool {
  function is_arraybuffer (line 64) | pub unsafe fn is_arraybuffer(env: Env, val: Local) -> bool {
  function is_typedarray (line 71) | pub unsafe fn is_typedarray(env: Env, val: Local) -> bool {
  function is_date (line 78) | pub unsafe fn is_date(env: Env, val: Local) -> bool {
  function is_promise (line 88) | pub unsafe fn is_promise(env: Env, val: Local) -> bool {
  function type_tag_object (line 95) | pub unsafe fn type_tag_object(env: Env, object: Local, tag: &super::Type...
  function check_object_type_tag (line 100) | pub unsafe fn check_object_type_tag(env: Env, object: Local, tag: &super...
  function is_bigint (line 108) | pub unsafe fn is_bigint(env: Env, val: Local) -> bool {

FILE: crates/neon/src/sys/tsfn.rs
  constant BOUNDARY (line 12) | const BOUNDARY: FailureBoundary = FailureBoundary {
  type Tsfn (line 19) | struct Tsfn(napi::ThreadsafeFunction);
  type ThreadsafeFunction (line 28) | pub struct ThreadsafeFunction<T> {
  type Callback (line 35) | struct Callback<T> {
  type CallError (line 41) | pub struct CallError;
  function new (line 46) | pub unsafe fn new(env: Env, callback: fn(Option<Env>, T)) -> Self {
  function with_capacity (line 52) | pub unsafe fn with_capacity(
  function call (line 87) | pub fn call(
  function reference (line 131) | pub unsafe fn reference(&self, env: Env) {
  function unref (line 137) | pub unsafe fn unref(&self, env: Env) {
  function finalize (line 143) | unsafe extern "C" fn finalize(_env: Env, data: *mut c_void, _hint: *mut ...
  function callback (line 160) | unsafe extern "C" fn callback(
  method drop (line 176) | fn drop(&mut self) {

FILE: crates/neon/src/sys/typedarray.rs
  type TypedArrayInfo (line 10) | pub struct TypedArrayInfo {
  function info (line 23) | pub unsafe fn info(env: Env, value: Local) -> TypedArrayInfo {
  function new (line 43) | pub unsafe fn new(

FILE: crates/neon/src/thread/mod.rs
  function next_id (line 115) | fn next_id() -> usize {
  type LocalKey (line 130) | pub struct LocalKey<T> {
  function new (line 138) | pub const fn new() -> Self {
  function id (line 145) | fn id(&self) -> usize {
  function get (line 153) | pub fn get<'cx, 'a, C>(&self, cx: &'a mut C) -> Option<&'cx T>
  function get_or_init (line 169) | pub fn get_or_init<'cx, 'a, C, F>(&self, cx: &'a mut C, f: F) -> &'cx T
  function get_or_try_init (line 193) | pub fn get_or_try_init<'cx, 'a, C, E, F>(&self, cx: &'a mut C, f: F) -> ...
  function get_or_init_default (line 213) | pub fn get_or_init_default<'cx, 'a, C>(&self, cx: &'a mut C) -> &'cx T

FILE: crates/neon/src/types_impl/bigint.rs
  type Sign (line 18) | pub enum Sign {
  type RangeError (line 31) | pub struct RangeError<T>(T);
  function into_inner (line 36) | pub fn into_inner(self) -> T {
  function fmt (line 45) | fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
  function or_throw (line 56) | fn or_throw<'a, C: Context<'a>>(self, cx: &mut C) -> NeonResult<T> {
  constant POSITIVE (line 62) | pub const POSITIVE: Sign = Sign::Positive;
  constant NEGATIVE (line 63) | pub const NEGATIVE: Sign = Sign::Negative;
  method from_i64 (line 76) | pub fn from_i64<'cx, C>(cx: &mut C, n: i64) -> Handle<'cx, Self>
  method from_u64 (line 101) | pub fn from_u64<'cx, C>(cx: &mut C, n: u64) -> Handle<'cx, Self>
  method from_u128_sign (line 116) | fn from_u128_sign<'cx, C>(cx: &mut C, sign: Sign, n: u128) -> Handle<'cx...
  method from_i128 (line 137) | pub fn from_i128<'cx, C>(cx: &mut C, n: i128) -> Handle<'cx, Self>
  method from_u128 (line 162) | pub fn from_u128<'cx, C>(cx: &mut C, n: u128) -> Handle<'cx, Self>
  method from_digits_le (line 191) | pub fn from_digits_le<'cx, C>(cx: &mut C, sign: Sign, digits: &[u64]) ->...
  method to_i64 (line 224) | pub fn to_i64<'cx, C>(&self, cx: &mut C) -> Result<i64, RangeError<i64>>
  method to_u64 (line 245) | pub fn to_u64<'cx, C>(&self, cx: &mut C) -> Result<u64, RangeError<u64>>
  method to_i128 (line 266) | pub fn to_i128<'cx, C>(&self, cx: &mut C) -> Result<i128, RangeError<i128>>
  method to_u128 (line 307) | pub fn to_u128<'cx, C>(&self, cx: &mut C) -> Result<u128, RangeError<u128>>
  method to_digits_le (line 331) | pub fn to_digits_le<'cx, C>(&self, cx: &mut C) -> (Sign, Vec<u64>)
  method read_digits_le (line 370) | pub fn read_digits_le<'cx, C>(&self, cx: &mut C, digits: &mut [u64]) -> ...
  method len (line 398) | pub fn len<'cx, C>(&self, cx: &mut C) -> usize
  type Inner (line 410) | type Inner = raw::Local;
  method into_inner (line 412) | fn into_inner(self) -> Self::Inner {
  method name (line 418) | fn name() -> &'static str {
  method is_typeof (line 422) | fn is_typeof<Other: Value>(cx: &mut Cx, other: &Other) -> bool {
  method to_local (line 426) | fn to_local(&self) -> raw::Local {
  method from_local (line 430) | unsafe fn from_local(_env: Env, h: raw::Local) -> Self {

FILE: crates/neon/src/types_impl/boxed.rs
  type BoxAny (line 17) | type BoxAny = Box<dyn Any + 'static>;
  type JsBoxInner (line 20) | pub struct JsBoxInner<T: 'static> {
  type JsBox (line 147) | pub struct JsBox<T: 'static>(JsBoxInner<T>);
  function fmt (line 150) | fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
  function fmt (line 156) | fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
  function maybe_external_deref (line 163) | unsafe fn maybe_external_deref<'a>(env: Env, local: raw::Local) -> Optio...
  method clone (line 169) | fn clone(&self) -> Self {
  type Inner (line 181) | type Inner = JsBoxInner<T>;
  method into_inner (line 183) | fn into_inner(self) -> Self::Inner {
  method name (line 189) | fn name() -> &'static str {
  method is_typeof (line 193) | fn is_typeof<Other: Value>(cx: &mut Cx, other: &Other) -> bool {
  method downcast (line 199) | fn downcast<Other: Value>(cx: &mut Cx, other: &Other) -> Option<Self> {
  method to_local (line 208) | fn to_local(&self) -> raw::Local {
  method from_local (line 212) | unsafe fn from_local(env: Env, local: raw::Local) -> Self {
  function new (line 237) | pub fn new<'cx, C: Context<'cx>>(cx: &mut C, value: T) -> Handle<'cx, Js...
  function manually_finalize (line 254) | pub(crate) fn manually_finalize<'cx>(cx: &mut Cx<'cx>, value: T) -> Hand...
  function create_external (line 260) | fn create_external<'cx, C: Context<'cx>>(
  function deref (line 282) | pub fn deref<'cx>(v: &Handle<'cx, Self>) -> &'cx T {
  function as_inner (line 293) | pub fn as_inner(&self) -> &'cx T {
  type Target (line 302) | type Target = T;
  method deref (line 304) | fn deref(&self) -> &Self::Target {
  type Finalize (line 346) | pub trait Finalize: Sized {
    method finalize (line 347) | fn finalize<'a, C: Context<'a>>(self, _: &mut C) {}
    method finalize (line 413) | fn finalize<'a, C: Context<'a>>(self, cx: &mut C) {
    method finalize (line 423) | fn finalize<'a, C: Context<'a>>(self, cx: &mut C) {
    method finalize (line 429) | fn finalize<'a, C: Context<'a>>(self, cx: &mut C) {
    method finalize (line 437) | fn finalize<'a, C: Context<'a>>(self, cx: &mut C) {
    method finalize (line 445) | fn finalize<'a, C: Context<'a>>(self, cx: &mut C) {
    method finalize (line 453) | fn finalize<'a, C: Context<'a>>(self, cx: &mut C) {
    method finalize (line 461) | fn finalize<'a, C: Context<'a>>(self, cx: &mut C) {
    method finalize (line 469) | fn finalize<'a, C: Context<'a>>(self, cx: &mut C) {
    method finalize (line 475) | fn finalize<'a, C: Context<'a>>(self, cx: &mut C) {

FILE: crates/neon/src/types_impl/buffer/lock.rs
  type Lock (line 15) | pub struct Lock<'cx, C> {
  function new (line 25) | pub fn new(cx: &'cx mut C) -> Lock<'cx, C> {
  type Ledger (line 37) | pub(super) struct Ledger {
    method slice_to_range (line 49) | pub(super) fn slice_to_range<T>(data: &[T]) -> Range<*const u8> {
    method try_borrow (line 57) | pub(super) fn try_borrow<'a, T>(
    method try_borrow_mut (line 70) | pub(super) fn try_borrow_mut<'a, T>(
    method try_add_borrow (line 82) | fn try_add_borrow<T>(&mut self, data: &[T]) -> Result<(), BorrowError> {
    method try_add_borrow_mut (line 95) | fn try_add_borrow_mut<T>(&mut self, data: &mut [T]) -> Result<(), Borr...
  function is_disjoint (line 111) | fn is_disjoint(a: &Range<*const u8>, b: &Range<*const u8>) -> bool {
  function check_overlap (line 115) | fn check_overlap(
  function unsafe_aliased_slice (line 136) | fn unsafe_aliased_slice<T>(data: &mut [T]) -> &'static mut [T] {
  function test_overlapping_immutable_borrows (line 141) | fn test_overlapping_immutable_borrows() -> Result<(), Box<dyn Error>> {
  function test_nonoverlapping_borrows (line 153) | fn test_nonoverlapping_borrows() -> Result<(), Box<dyn Error>> {
  function test_overlapping_borrows (line 165) | fn test_overlapping_borrows() -> Result<(), Box<dyn Error>> {

FILE: crates/neon/src/types_impl/buffer/mod.rs
  type TypedArray (line 50) | pub trait TypedArray: Value {
    method as_slice (line 57) | fn as_slice<'cx, 'a, C>(&self, cx: &'a C) -> &'a [Self::Item]
    method as_mut_slice (line 65) | fn as_mut_slice<'cx, 'a, C>(&mut self, cx: &'a mut C) -> &'a mut [Self...
    method try_borrow (line 75) | fn try_borrow<'cx, 'a, C>(&self, lock: &'a Lock<C>) -> Result<Ref<'a, ...
    method try_borrow_mut (line 85) | fn try_borrow_mut<'cx, 'a, C>(
    method size (line 93) | fn size<'cx, C>(&self, cx: &mut C) -> usize
    method from_slice (line 98) | fn from_slice<'cx, C>(cx: &mut C, slice: &[Self::Item]) -> JsResult<'c...
  type Ref (line 105) | pub struct Ref<'a, T> {
  type RefMut (line 112) | pub struct RefMut<'a, T> {
  type Target (line 118) | type Target = [T];
  method deref (line 120) | fn deref(&self) -> &Self::Target {
  type Target (line 126) | type Target = [T];
  method deref (line 128) | fn deref(&self) -> &Self::Target {
  method deref_mut (line 134) | fn deref_mut(&mut self) -> &mut Self::Target {
  method drop (line 140) | fn drop(&mut self) {
  method drop (line 154) | fn drop(&mut self) {
  type BorrowError (line 172) | pub struct BorrowError {
    method new (line 177) | fn new() -> Self {
  method fmt (line 185) | fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
  method fmt (line 191) | fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
  function or_throw (line 197) | fn or_throw<'a, C: Context<'a>>(self, cx: &mut C) -> NeonResult<T> {
  type Region (line 236) | pub struct Region<'cx, T: Binary> {
  function buffer (line 249) | pub fn buffer(&self) -> Handle<'cx, JsArrayBuffer> {
  function offset (line 254) | pub fn offset(&self) -> usize {
  function len (line 260) | pub fn len(&self) -> usize {
  function size (line 266) | pub fn size(&self) -> usize {
  function to_typed_array (line 278) | pub fn to_typed_array<'c, C>(&self, cx: &mut C) -> JsResult<'c, JsTypedA...
  type Sealed (line 292) | pub trait Sealed {}
  type JsTypedArrayInner (line 295) | pub struct JsTypedArrayInner<T: Binary> {
  method fmt (line 302) | fn fmt(&self, f: &mut Formatter) -> Result<(), std::fmt::Error> {

FILE: crates/neon/src/types_impl/buffer/types.rs
  type JsBuffer (line 54) | pub struct JsBuffer(raw::Local);
    method new (line 60) | pub fn new<'a, C: Context<'a>>(cx: &mut C, len: usize) -> JsResult<'a,...
    method from_slice (line 76) | pub fn from_slice<'cx, C>(cx: &mut C, slice: &[u8]) -> JsResult<'cx, S...
    method uninitialized (line 84) | pub unsafe fn uninitialized<'a, C: Context<'a>>(cx: &mut C, len: usize...
    method external (line 109) | pub fn external<'a, C, T>(cx: &mut C, data: T) -> Handle<'a, Self>
  type Inner (line 122) | type Inner = raw::Local;
  method into_inner (line 124) | fn into_inner(self) -> Self::Inner {
  method name (line 130) | fn name() -> &'static str {
  method is_typeof (line 134) | fn is_typeof<Other: Value>(cx: &mut Cx, other: &Other) -> bool {
  method to_local (line 138) | fn to_local(&self) -> raw::Local {
  method from_local (line 142) | unsafe fn from_local(_env: Env, h: raw::Local) -> Self {
  type Item (line 154) | type Item = u8;
  method as_slice (line 156) | fn as_slice<'cx, 'a, C>(&self, cx: &'a C) -> &'a [Self::Item]
  method as_mut_slice (line 169) | fn as_mut_slice<'cx, 'a, C>(&mut self, cx: &'a mut C) -> &'a mut [Self::...
  method try_borrow (line 178) | fn try_borrow<'cx, 'a, C>(&self, lock: &'a Lock<C>) -> Result<Ref<'a, Se...
  method try_borrow_mut (line 188) | fn try_borrow_mut<'cx, 'a, C>(
  method size (line 201) | fn size<'cx, C: Context<'cx>>(&self, cx: &mut C) -> usize {
  method from_slice (line 205) | fn from_slice<'cx, C>(cx: &mut C, slice: &[u8]) -> JsResult<'cx, Self>
  type JsArrayBuffer (line 239) | pub struct JsArrayBuffer(raw::Local);
    method new (line 245) | pub fn new<'a, C: Context<'a>>(cx: &mut C, len: usize) -> JsResult<'a,...
    method from_slice (line 261) | pub fn from_slice<'cx, C>(cx: &mut C, slice: &[u8]) -> JsResult<'cx, S...
    method external (line 283) | pub fn external<'a, C, T>(cx: &mut C, data: T) -> Handle<'a, Self>
    method region (line 298) | pub fn region<'cx, T: Binary>(
  function region (line 328) | pub fn region<T: Binary>(&self, offset: usize, len: usize) -> Region<'cx...
  type Inner (line 339) | type Inner = raw::Local;
  method into_inner (line 341) | fn into_inner(self) -> Self::Inner {
  method name (line 347) | fn name() -> &'static str {
  method is_typeof (line 351) | fn is_typeof<Other: Value>(cx: &mut Cx, other: &Other) -> bool {
  method to_local (line 355) | fn to_local(&self) -> raw::Local {
  method from_local (line 359) | unsafe fn from_local(_env: Env, h: raw::Local) -> Self {
  type Item (line 371) | type Item = u8;
  method as_slice (line 373) | fn as_slice<'cx, 'a, C>(&self, cx: &'a C) -> &'a [Self::Item]
  method as_mut_slice (line 380) | fn as_mut_slice<'cx, 'a, C>(&mut self, cx: &'a mut C) -> &'a mut [Self::...
  method try_borrow (line 387) | fn try_borrow<'cx, 'a, C>(&self, lock: &'a Lock<C>) -> Result<Ref<'a, Se...
  method try_borrow_mut (line 397) | fn try_borrow_mut<'cx, 'a, C>(
  method size (line 410) | fn size<'cx, C: Context<'cx>>(&self, cx: &mut C) -> usize {
  method from_slice (line 414) | fn from_slice<'cx, C>(cx: &mut C, slice: &[u8]) -> JsResult<'cx, Self>
  type Binary (line 429) | pub trait Binary: private::Sealed + Copy {
    constant TYPE_TAG (line 431) | const TYPE_TAG: TypedArrayType;
  type JsTypedArray (line 527) | pub struct JsTypedArray<T: Binary>(JsTypedArrayInner<T>);
  type Inner (line 532) | type Inner = JsTypedArrayInner<T>;
  method into_inner (line 534) | fn into_inner(self) -> Self::Inner {
  type Item (line 544) | type Item = T;
  method as_slice (line 546) | fn as_slice<'cx, 'a, C>(&self, cx: &'a C) -> &'a [Self::Item]
  method as_mut_slice (line 559) | fn as_mut_slice<'cx, 'a, C>(&mut self, cx: &'a mut C) -> &'a mut [Self::...
  method try_borrow (line 572) | fn try_borrow<'cx, 'b, C>(
  method try_borrow_mut (line 589) | fn try_borrow_mut<'cx, 'a, C>(
  method size (line 606) | fn size<'cx, C: Context<'cx>>(&self, cx: &mut C) -> usize {
  method from_slice (line 610) | fn from_slice<'cx, C>(cx: &mut C, slice: &[T]) -> JsResult<'cx, Self>
  function from_slice (line 634) | pub fn from_slice<'cx, C>(cx: &mut C, slice: &[T]) -> JsResult<'cx, Self>
  function from_buffer (line 650) | pub fn from_buffer<'cx, 'b: 'cx, C>(
  function from_region (line 678) | pub fn from_region<'c, 'r, C>(cx: &mut C, region: &Region<'r, T>) -> JsR...
  function region (line 708) | pub fn region<'cx, C>(&self, cx: &mut C) -> Region<'cx, T>
  function new (line 727) | pub fn new<'cx, C>(cx: &mut C, len: usize) -> JsResult<'cx, Self>
  function buffer (line 742) | pub fn buffer<'cx, C>(&self, cx: &mut C) -> Handle<'cx, JsArrayBuffer>
  function offset (line 751) | pub fn offset<'cx, C>(&self, cx: &mut C) -> usize
  function len (line 768) | pub fn len<'cx, C>(&self, cx: &mut C) -> usize
  function slice_from_info (line 777) | unsafe fn slice_from_info<'a, T>(info: TypedArrayInfo) -> &'a [T] {
  function slice_from_info_mut (line 785) | unsafe fn slice_from_info_mut<'a, T>(info: TypedArrayInfo) -> &'a mut [T] {

FILE: crates/neon/src/types_impl/date.rs
  type JsDate (line 55) | pub struct JsDate(raw::Local);
    constant MIN_VALUE (line 117) | pub const MIN_VALUE: f64 = -8.64e15;
    constant MAX_VALUE (line 120) | pub const MAX_VALUE: f64 = 8.64e15;
    method new (line 125) | pub fn new<'a, C: Context<'a>, T: Into<f64>>(
    method new_lossy (line 145) | pub fn new_lossy<'a, C: Context<'a>, V: Into<f64>>(cx: &mut C, value: ...
    method value (line 152) | pub fn value<'a, C: Context<'a>>(&self, cx: &mut C) -> f64 {
    method is_valid (line 159) | pub fn is_valid<'a, C: Context<'a>>(&self, cx: &mut C) -> bool {
  type Inner (line 60) | type Inner = raw::Local;
  method into_inner (line 62) | fn into_inner(self) -> Self::Inner {
  type DateError (line 70) | pub struct DateError(DateErrorKind);
    method kind (line 73) | pub fn kind(&self) -> DateErrorKind {
    method fmt (line 79) | fn fmt(&self, fmt: &mut fmt::Formatter) -> fmt::Result {
  type DateErrorKind (line 89) | pub enum DateErrorKind {
    method as_str (line 99) | fn as_str(&self) -> &'static str {
  function or_throw (line 109) | fn or_throw<'b, C: Context<'b>>(self, cx: &mut C) -> JsResult<'a, T> {
  method name (line 166) | fn name() -> &'static str {
  method is_typeof (line 170) | fn is_typeof<Other: Value>(cx: &mut Cx, other: &Other) -> bool {
  method to_local (line 174) | fn to_local(&self) -> raw::Local {
  method from_local (line 178) | unsafe fn from_local(_env: Env, h: raw::Local) -> Self {

FILE: crates/neon/src/types_impl/error.rs
  type JsError (line 40) | pub struct JsError(raw::Local);
    method error (line 76) | pub fn error<'a, C: Context<'a>, S: AsRef<str>>(
    method type_error (line 90) | pub fn type_error<'a, C: Context<'a>, S: AsRef<str>>(
    method range_error (line 104) | pub fn range_error<'a, C: Context<'a>, S: AsRef<str>>(
  type Inner (line 43) | type Inner = raw::Local;
  method into_inner (line 45) | fn into_inner(self) -> Self::Inner {
  method name (line 51) | fn name() -> &'static str {
  method is_typeof (line 55) | fn is_typeof<Other: Value>(cx: &mut Cx, other: &Other) -> bool {
  method to_local (line 59) | fn to_local(&self) -> raw::Local {
  method from_local (line 63) | unsafe fn from_local(_env: Env, h: raw::Local) -> Self {
  function convert_panics (line 116) | pub(crate) fn convert_panics<T, F: UnwindSafe + FnOnce() -> NeonResult<T>>(

FILE: crates/neon/src/types_impl/extract/array.rs
  type Array (line 43) | pub struct Array<T>(pub T);
  type Error (line 53) | type Error = ArrayError<<T::Item as TryFromJs<'cx>>::Error>;
  function try_from_js (line 55) | fn try_from_js(
  type Value (line 102) | type Value = JsArray;
  function try_into_js (line 104) | fn try_into_js(self, cx: &mut Cx<'cx>) -> JsResult<'cx, Self::Value> {
  type ArrayError (line 139) | pub enum ArrayError<E> {
  function array (line 147) | fn array() -> Self {
  function item (line 151) | fn item(err: E) -> Self {
  function fmt (line 160) | fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
  type Value (line 174) | type Value = JsValue;
  function try_into_js (line 176) | fn try_into_js(self, cx: &mut Cx<'cx>) -> JsResult<'cx, Self::Value> {

FILE: crates/neon/src/types_impl/extract/boxed.rs
  type Boxed (line 45) | pub struct Boxed<T>(pub T);
  type Error (line 51) | type Error = TypeExpected<JsBox<T>>;
  function try_from_js (line 53) | fn try_from_js(
  type Value (line 68) | type Value = JsBox<T>;
  function try_into_js (line 70) | fn try_into_js(self, cx: &mut Cx<'cx>) -> JsResult<'cx, Self::Value> {

FILE: crates/neon/src/types_impl/extract/buffer.rs
  type ArrayBuffer (line 15) | pub struct ArrayBuffer<B>(pub B);
  type Error (line 21) | type Error = TypeExpected<JsBuffer>;
  function try_from_js (line 23) | fn try_from_js(
  type Value (line 40) | type Value = JsArrayBuffer;
  function try_into_js (line 42) | fn try_into_js(self, cx: &mut Cx<'cx>) -> JsResult<'cx, Self::Value> {
  type Buffer (line 50) | pub struct Buffer<B>(pub B);
  type Error (line 56) | type Error = TypeExpected<JsBuffer>;
  function try_from_js (line 58) | fn try_from_js(
  type Value (line 75) | type Value = JsBuffer;
  function try_into_js (line 77) | fn try_into_js(self, cx: &mut Cx<'cx>) -> JsResult<'cx, Self::Value> {
  type Value (line 89) | type Value = JsTypedArray<T>;
  function try_into_js (line 91) | fn try_into_js(self, cx: &mut Cx<'cx>) -> JsResult<'cx, Self::Value> {
  type Error (line 101) | type Error = TypeExpected<JsTypedArray<T>>;
  function try_from_js (line 103) | fn try_from_js(
  type Value (line 128) | type Value = JsTypedArray<T>;
  function try_into_js (line 130) | fn try_into_js(self, cx: &mut Cx<'cx>) -> JsResult<'cx, Self::Value> {
  type Value (line 147) | type Value = JsTypedArray<T>;
  function try_into_js (line 149) | fn try_into_js(self, cx: &mut Cx<'cx>) -> JsResult<'cx, Self::Value> {

FILE: crates/neon/src/types_impl/extract/container.rs
  type Error (line 20) | type Error = TypeExpected<JsBox<RefCell<T>>>;
  function try_from_js (line 22) | fn try_from_js(
  type Error (line 34) | type Error = TypeExpected<JsBox<RefCell<T>>>;
  function try_from_js (line 36) | fn try_from_js(
  type Error (line 51) | type Error = TypeExpected<JsBox<RefCell<T>>>;
  function try_from_js (line 53) | fn try_from_js(
  type Value (line 71) | type Value = JsBox<RefCell<T>>;
  function try_into_js (line 73) | fn try_into_js(self, cx: &mut Cx<'cx>) -> JsResult<'cx, Self::Value> {
  type Error (line 79) | type Error = TypeExpected<JsBox<Rc<T>>>;
  function try_from_js (line 81) | fn try_from_js(
  type Value (line 96) | type Value = JsBox<Rc<T>>;
  function try_into_js (line 98) | fn try_into_js(self, cx: &mut Cx<'cx>) -> JsResult<'cx, Self::Value> {
  type Error (line 104) | type Error = TypeExpected<JsBox<Arc<T>>>;
  function try_from_js (line 106) | fn try_from_js(
  type Value (line 121) | type Value = JsBox<Arc<T>>;
  function try_into_js (line 123) | fn try_into_js(self, cx: &mut Cx<'cx>) -> JsResult<'cx, Self::Value> {
  type Value (line 134) | type Value = V;
  function try_into_js (line 136) | fn try_into_js(self, cx: &mut Cx<'cx>) -> JsResult<'cx, Self::Value> {

FILE: crates/neon/src/types_impl/extract/either.rs
  type Error (line 21) | type Error = Error<L::Error, R::Error>;
  function try_from_js (line 23) | fn try_from_js(
  type Value (line 46) | type Value = JsValue;
  function try_into_js (line 48) | fn try_into_js(self, cx: &mut Cx<'cx>) -> JsResult<'cx, Self::Value> {
  type Error (line 59) | pub struct Error<L, R> {
  function new (line 65) | fn new<LT, RT>(left: L, right: R) -> Self
  function fmt (line 82) | fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
  type Value (line 100) | type Value = JsError;
  function try_into_js (line 102) | fn try_into_js(self, cx: &mut Cx<'cx>) -> JsResult<'cx, Self::Value> {

FILE: crates/neon/src/types_impl/extract/error.rs
  type BoxError (line 12) | type BoxError = Box<dyn error::Error + Send + Sync + 'static>;
  type TypeExpected (line 15) | pub struct TypeExpected<T: Value>(PhantomData<T>);
  function new (line 18) | pub(super) fn new() -> Self {
  function fmt (line 24) | fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
  function fmt (line 30) | fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
  type Value (line 38) | type Value = JsError;
  function try_into_js (line 40) | fn try_into_js(self, cx: &mut Cx<'cx>) -> JsResult<'cx, Self::Value> {
  type Value (line 48) | type Value = JsValue;
  method try_into_js (line 50) | fn try_into_js(self, _: &mut Cx<'cx>) -> JsResult<'cx, Self::Value> {
  type Error (line 74) | pub struct Error {
    method new (line 88) | pub fn new<E>(cause: E) -> Self
    method range_error (line 96) | pub fn range_error<E>(cause: E) -> Self
    method type_error (line 104) | pub fn type_error<E>(cause: E) -> Self
    method is_range_error (line 112) | pub fn is_range_error(&self) -> bool {
    method is_type_error (line 117) | pub fn is_type_error(&self) -> bool {
    method cause (line 122) | pub fn cause(&self) -> &BoxError {
    method into_cause (line 127) | pub fn into_cause(self) -> BoxError {
    method create (line 131) | fn create<E>(kind: ErrorKind, cause: E) -> Self
    method from (line 147) | fn from(cause: E) -> Self {
    method fmt (line 153) | fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
    type Value (line 161) | type Value = JsError;
    method try_into_js (line 163) | fn try_into_js(self, cx: &mut Cx<'cx>) -> JsResult<'cx, Self::Value> {
  type ErrorKind (line 80) | enum ErrorKind {

FILE: crates/neon/src/types_impl/extract/json.rs
  function global_json_stringify (line 33) | fn global_json_stringify<'cx>(cx: &mut Cx<'cx>) -> JsResult<'cx, JsFunct...
  function json_stringify (line 42) | fn json_stringify<'cx>(cx: &mut Cx<'cx>) -> JsResult<'cx, JsFunction> {
  function json_stringify (line 47) | fn json_stringify<'cx>(cx: &mut Cx<'cx>) -> JsResult<'cx, JsFunction> {
  function global_json_parse (line 55) | fn global_json_parse<'cx>(cx: &mut Cx<'cx>) -> JsResult<'cx, JsFunction> {
  function json_parse (line 60) | fn json_parse<'cx>(cx: &mut Cx<'cx>) -> JsResult<'cx, JsFunction> {
  function json_parse (line 65) | fn json_parse<'cx>(cx: &mut Cx<'cx>) -> JsResult<'cx, JsFunction> {
  function parse (line 73) | fn parse<'cx>(cx: &mut Cx<'cx>, s: &str) -> JsResult<'cx, JsValue> {
  type Json (line 81) | pub struct Json<T>(pub T);
  type Error (line 87) | type Error = Error;
    method fmt (line 136) | fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
    method fmt (line 142) | fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
    type Value (line 150) | type Value = JsError;
    method try_into_js (line 152) | fn try_into_js(self, cx: &mut Cx<'cx>) -> JsResult<'cx, Self::Value> {
  function try_from_js (line 89) | fn try_from_js(
  type Value (line 108) | type Value = JsValue;
  function try_into_js (line 110) | fn try_into_js(self, cx: &mut Cx<'cx>) -> JsResult<'cx, Self::Value> {
  type Value (line 119) | type Value = JsValue;
  function try_into_js (line 121) | fn try_into_js(self, cx: &mut Cx<'cx>) -> JsResult<'cx, Self::Value> {
  type Error (line 133) | pub struct Error(serde_json::Error);
    method fmt (line 136) | fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
    method fmt (line 142) | fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
    type Value (line 150) | type Value = JsError;
    method try_into_js (line 152) | fn try_into_js(self, cx: &mut Cx<'cx>) -> JsResult<'cx, Self::Value> {

FILE: crates/neon/src/types_impl/extract/mod.rs
  type TryFromJs (line 140) | pub trait TryFromJs<'cx>
    method try_from_js (line 147) | fn try_from_js(
    method from_js (line 153) | fn from_js(cx: &mut Cx<'cx>, v: Handle<'cx, JsValue>) -> NeonResult<Se...
  type TryIntoJs (line 166) | pub trait TryIntoJs<'cx>
    method try_into_js (line 174) | fn try_into_js(self, cx: &mut Cx<'cx>) -> JsResult<'cx, Self::Value>;
  type TryFromJsRef (line 193) | pub trait TryFromJsRef<'cx>
    method try_from_js_ref (line 204) | fn try_from_js_ref(
    method from_js_ref (line 210) | fn from_js_ref(cx: &mut Cx<'cx>, v: Handle<'cx, JsValue>) -> NeonResul...
  type TryFromJsRefMut (line 238) | pub trait TryFromJsRefMut<'cx>
    method try_from_js_ref_mut (line 249) | fn try_from_js_ref_mut(
    method from_js_ref_mut (line 255) | fn from_js_ref_mut(cx: &mut Cx<'cx>, v: Handle<'cx, JsValue>) -> NeonR...
  type Date (line 269) | pub struct Date(pub f64);
  type FromArgs (line 275) | pub trait FromArgs<'cx>: private::FromArgsInternal<'cx> {}
  function from_args (line 279) | fn from_args(_cx: &mut FunctionContext<'cx>) -> NeonResult<Self> {
  function from_args_opt (line 283) | fn from_args_opt(_cx: &mut FunctionContext<'cx>) -> NeonResult<Option<Se...

FILE: crates/neon/src/types_impl/extract/private.rs
  type Sealed (line 18) | pub trait Sealed {}
  type FromArgsInternal (line 20) | pub trait FromArgsInternal<'cx>: Sized {
    method from_args (line 21) | fn from_args(cx: &mut FunctionContext<'cx>) -> NeonResult<Self>;
    method from_args_opt (line 23) | fn from_args_opt(cx: &mut FunctionContext<'cx>) -> NeonResult<Option<S...

FILE: crates/neon/src/types_impl/extract/try_from_js.rs
  type Error (line 28) | type Error = TypeExpected<V>;
  function try_from_js (line 30) | fn try_from_js(
  type Error (line 42) | type Error = TypeExpected<O>;
  function try_from_js (line 44) | fn try_from_js(
  type Error (line 59) | type Error = T::Error;
  function try_from_js (line 61) | fn try_from_js(
  type Error (line 74) | type Error = TypeExpected<JsNumber>;
  function try_from_js (line 76) | fn try_from_js(
  type Error (line 95) | type Error = TypeExpected<JsNumber>;
  function try_from_js (line 97) | fn try_from_js(
  type Error (line 116) | type Error = TypeExpected<JsNumber>;
  function try_from_js (line 118) | fn try_from_js(
  type Error (line 137) | type Error = TypeExpected<JsBoolean>;
  function try_from_js (line 139) | fn try_from_js(
  type Error (line 158) | type Error = TypeExpected<JsString>;
  method try_from_js (line 160) | fn try_from_js(
  type Error (line 203) | type Error = TypeExpected<JsDate>;
  method try_from_js (line 205) | fn try_from_js(
  type Error (line 234) | type Error = Infallible;
  function try_from_js (line 236) | fn try_from_js(
  function is_null_or_undefined (line 244) | fn is_null_or_undefined<V>(cx: &mut Cx, v: Handle<V>) -> NeonResult<bool>

FILE: crates/neon/src/types_impl/extract/try_into_js.rs
  type Value (line 19) | type Value = T;
  function try_into_js (line 21) | fn try_into_js(self, _cx: &mut Cx<'cx>) -> JsResult<'cx, Self::Value> {
  type Value (line 30) | type Value = O;
  function try_into_js (line 32) | fn try_into_js(self, cx: &mut Cx<'cx>) -> JsResult<'cx, Self::Value> {
  type Value (line 42) | type Value = T::Value;
  function try_into_js (line 44) | fn try_into_js(self, cx: &mut Cx<'cx>) -> JsResult<'cx, Self::Value> {
  type Value (line 57) | type Value = JsValue;
  method try_into_js (line 59) | fn try_into_js(self, _cx: &mut Cx<'cx>) -> JsResult<'cx, Self::Value> {
  type Value (line 68) | type Value = JsValue;
  function try_into_js (line 70) | fn try_into_js(self, cx: &mut Cx<'cx>) -> JsResult<'cx, Self::Value> {
  type Value (line 83) | type Value = T::Value;
  function try_into_js (line 85) | fn try_into_js(self, cx: &mut Cx<'cx>) -> JsResult<'cx, Self::Value> {
  type Value (line 111) | type Value = JsString;
  method try_into_js (line 113) | fn try_into_js(self, cx: &mut Cx<'cx>) -> JsResult<'cx, Self::Value> {
  type Value (line 119) | type Value = JsString;
  function try_into_js (line 121) | fn try_into_js(self, cx: &mut Cx<'cx>) -> JsResult<'cx, Self::Value> {
  type Value (line 127) | type Value = JsString;
  function try_into_js (line 129) | fn try_into_js(self, cx: &mut Cx<'cx>) -> JsResult<'cx, Self::Value> {
  type Value (line 135) | type Value = JsBoolean;
  function try_into_js (line 137) | fn try_into_js(self, cx: &mut Cx<'cx>) -> JsResult<'cx, Self::Value> {
  type Value (line 143) | type Value = JsUndefined;
  function try_into_js (line 145) | fn try_into_js(self, cx: &mut Cx<'cx>) -> JsResult<'cx, Self::Value> {
  type Value (line 152) | type Value = JsDate;
  method try_into_js (line 154) | fn try_into_js(self, cx: &mut Cx<'cx>) -> JsResult<'cx, Self::Value> {

FILE: crates/neon/src/types_impl/extract/with.rs
  type With (line 7) | struct With<F>(pub F);
  function with (line 42) | pub fn with<V, F>(f: F) -> impl for<'cx> TryIntoJs<'cx, Value = V>
  type Value (line 55) | type Value = O::Value;
  function try_into_js (line 57) | fn try_into_js(self, cx: &mut Cx<'cx>) -> JsResult<'cx, Self::Value> {

FILE: crates/neon/src/types_impl/function/mod.rs
  type BindOptions (line 33) | pub struct BindOptions<'a, 'cx: 'a> {
  function this (line 42) | pub fn this<T: TryIntoJs<'cx>>(&mut self, this: T) -> NeonResult<&mut Se...
  function args (line 49) | pub fn args<A: TryIntoArguments<'cx>>(&mut self, a: A) -> NeonResult<&mu...
  function args_with (line 55) | pub fn args_with<R, F>(&mut self, f: F) -> NeonResult<&mut Self>
  function arg (line 65) | pub fn arg<A: TryIntoJs<'cx>>(&mut self, a: A) -> NeonResult<&mut Self> {
  function arg_with (line 72) | pub fn arg_with<R, F>(&mut self, f: F) -> NeonResult<&mut Self>
  function call (line 84) | pub fn call<R: TryFromJs<'cx>>(&mut self) -> NeonResult<R> {
  function construct (line 92) | pub fn construct<R: TryFromJs<'cx>>(&mut self) -> NeonResult<R> {
  function exec (line 100) | pub fn exec(&mut self) -> NeonResult<()> {
  type CallOptions (line 122) | pub struct CallOptions<'a> {
  function this (line 130) | pub fn this<V: Value>(&mut self, this: Handle<'a, V>) -> &mut Self {
  function arg (line 136) | pub fn arg<V: Value>(&mut self, arg: Handle<'a, V>) -> &mut Self {
  function args (line 142) | pub fn args<A: Arguments<'a>>(&mut self, args: A) -> &mut Self {
  function apply (line 149) | pub fn apply<'b: 'a, V: Value, C: Context<'b>>(&self, cx: &mut C) -> JsR...
  function exec (line 158) | pub fn exec<'b: 'a, C: Context<'b>>(&self, cx: &mut C) -> NeonResult<()> {
  type ConstructOptions (line 181) | pub struct ConstructOptions<'a> {
  function arg (line 188) | pub fn arg<V: Value>(&mut self, arg: Handle<'a, V>) -> &mut Self {
  function args (line 194) | pub fn args<A: Arguments<'a>>(&mut self, args: A) -> &mut Self {
  function apply (line 201) | pub fn apply<'b: 'a, O: Object, C: Context<'b>>(&self, cx: &mut C) -> Js...
  type TryIntoArguments (line 212) | pub trait TryIntoArguments<'cx>: private::TryIntoArgumentsInternal<'cx> {}
  function try_into_args_vec (line 215) | fn try_into_args_vec(self, _cx: &mut Cx<'cx>) -> NeonResult<private::Arg...
  function try_into_args_vec (line 225) | fn try_into_args_vec(self, cx: &mut Cx<'cx>) -> NeonResult<private::Args...
  type Arguments (line 299) | pub trait Arguments<'a>: private::ArgumentsInternal<'a> {}
  function into_args_vec (line 302) | fn into_args_vec(self) -> private::ArgsVec<'a> {

FILE: crates/neon/src/types_impl/function/private.rs
  type ArgsVec (line 5) | pub type ArgsVec<'a> = SmallVec<[Handle<'a, JsValue>; 8]>;
  type TryIntoArgumentsInternal (line 8) | pub trait TryIntoArgumentsInternal<'cx> {
    method try_into_args_vec (line 9) | fn try_into_args_vec(self, cx: &mut Cx<'cx>) -> NeonResult<ArgsVec<'cx>>;
  type ArgumentsInternal (line 13) | pub trait ArgumentsInternal<'a> {
    method into_args_vec (line 14) | fn into_args_vec(self) -> ArgsVec<'a>;

FILE: crates/neon/src/types_impl/mod.rs
  function build (line 65) | pub(crate) fn build<'a, T: Value, F: FnOnce(&mut raw::Local) -> bool>(
  type Value (line 92) | pub trait Value: ValueInternal {
    method to_string (line 93) | fn to_string<'cx, C: Context<'cx>>(&self, cx: &mut C) -> JsResult<'cx,...
    method as_value (line 100) | fn as_value<'cx, C: Context<'cx>>(&self, _: &mut C) -> Handle<'cx, JsV...
    method to_raw (line 107) | fn to_raw(&self) -> sys::Value {
    method from_raw (line 119) | unsafe fn from_raw<'cx, C: Context<'cx>>(cx: &C, value: sys::Value) ->...
  type JsValue (line 162) | pub struct JsValue(raw::Local);
    method upcast_internal (line 80) | fn upcast_internal(v: &T) -> JsValue {
    method new_internal (line 193) | pub(crate) fn new_internal<'a>(value: raw::Local) -> Handle<'a, JsValu...
  type Inner (line 167) | type Inner = raw::Local;
  method into_inner (line 169) | fn into_inner(self) -> Self::Inner {
  method name (line 175) | fn name() -> &'static str {
  method is_typeof (line 179) | fn is_typeof<Other: Value>(_cx: &mut Cx, _other: &Other) -> bool {
  method to_local (line 183) | fn to_local(&self) -> raw::Local {
  method from_local (line 187) | unsafe fn from_local(_env: Env, h: raw::Local) -> Self {
  type JsUndefined (line 220) | pub struct JsUndefined(raw::Local);
    method new (line 229) | pub fn new<'a, C: Context<'a>>(cx: &mut C) -> Handle<'a, JsUndefined> {
    method new_internal (line 233) | pub(crate) fn new_internal<'a>(env: Env) -> Handle<'a, JsUndefined> {
  type Inner (line 245) | type Inner = raw::Local;
  method into_inner (line 247) | fn into_inner(self) -> Self::Inner {
  method name (line 253) | fn name() -> &'static str {
  method is_typeof (line 257) | fn is_typeof<Other: Value>(cx: &mut Cx, other: &Other) -> bool {
  method to_local (line 261) | fn to_local(&self) -> raw::Local {
  method from_local (line 265) | unsafe fn from_local(_env: Env, h: raw::Local) -> Self {
  type JsNull (line 289) | pub struct JsNull(raw::Local);
    method new (line 298) | pub fn new<'a, C: Context<'a>>(cx: &mut C) -> Handle<'a, JsNull> {
    method new_internal (line 302) | pub(crate) fn new_internal<'a>(env: Env) -> Handle<'a, JsNull> {
  type Inner (line 314) | type Inner = raw::Local;
  method into_inner (line 316) | fn into_inner(self) -> Self::Inner {
  method name (line 322) | fn name() -> &'static str {
  method is_typeof (line 326) | fn is_typeof<Other: Value>(cx: &mut Cx, other: &Other) -> bool {
  method to_local (line 330) | fn to_local(&self) -> raw::Local {
  method from_local (line 334) | unsafe fn from_local(_env: Env, h: raw::Local) -> Self {
  type JsBoolean (line 359) | pub struct JsBoolean(raw::Local);
    method new (line 365) | pub fn new<'a, C: Context<'a>>(cx: &mut C, b: bool) -> Handle<'a, JsBo...
    method new_internal (line 369) | pub(crate) fn new_internal<'a>(env: Env, b: bool) -> Handle<'a, JsBool...
    method value (line 378) | pub fn value<'a, C: Context<'a>>(&self, cx: &mut C) -> bool {
  type Inner (line 387) | type Inner = raw::Local;
  method into_inner (line 389) | fn into_inner(self) -> Self::Inner {
  method name (line 395) | fn name() -> &'static str {
  method is_typeof (line 399) | fn is_typeof<Other: Value>(cx: &mut Cx, other: &Other) -> bool {
  method to_local (line 403) | fn to_local(&self) -> raw::Local {
  method from_local (line 407) | unsafe fn from_local(_env: Env, h: raw::Local) -> Self {
  type JsString (line 431) | pub struct JsString(raw::Local);
    method size (line 504) | pub fn size<'a, C: Context<'a>>(&self, cx: &mut C) -> usize {
    method size_utf16 (line 530) | pub fn size_utf16<'a, C: Context<'a>>(&self, cx: &mut C) -> usize {
    method value (line 552) | pub fn value<'a, C: Context<'a>>(&self, cx: &mut C) -> String {
    method to_utf16 (line 604) | pub fn to_utf16<'a, C: Context<'a>>(&self, cx: &mut C) -> Vec<u16> {
    method new (line 633) | pub fn new<'a, C: Context<'a>, S: AsRef<str>>(cx: &mut C, val: S) -> H...
    method try_new (line 659) | pub fn try_new<'a, C: Context<'a>, S: AsRef<str>>(cx: &mut C, val: S) ...
    method new_internal (line 667) | pub(crate) fn new_internal<'a>(env: Env, val: &str) -> Option<Handle<'...
  type StringOverflow (line 435) | pub struct StringOverflow(usize);
    method fmt (line 438) | fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
  type StringResult (line 444) | pub type StringResult<'a> = Result<Handle<'a, JsString>, StringOverflow>;
  function or_throw (line 447) | fn or_throw<'b, C: Context<'b>>(self, cx: &mut C) -> JsResult<'a, JsStri...
  type Inner (line 458) | type Inner = raw::Local;
  method into_inner (line 460) | fn into_inner(self) -> Self::Inner {
  method name (line 466) | fn name() -> &'static str {
  method is_typeof (line 470) | fn is_typeof<Other: Value>(cx: &mut Cx, other: &Other) -> bool {
  method to_local (line 474) | fn to_local(&self) -> raw::Local {
  method from_local (line 478) | unsafe fn from_local(_env: Env, h: raw::Local) -> Self {
  type JsNumber (line 704) | pub struct JsNumber(raw::Local);
    method new (line 710) | pub fn new<'a, C: Context<'a>, T: Into<f64>>(cx: &mut C, x: T) -> Hand...
    method new_internal (line 714) | pub(crate) fn new_internal<'a>(env: Env, v: f64) -> Handle<'a, JsNumbe...
    method value (line 723) | pub fn value<'a, C: Context<'a>>(&self, cx: &mut C) -> f64 {
  type Inner (line 732) | type Inner = raw::Local;
  method into_inner (line 734) | fn into_inner(self) -> Self::Inner {
  method name (line 740) | fn name() -> &'static str {
  method is_typeof (line 744) | fn is_typeof<Other: Value>(cx: &mut Cx, other: &Other) -> bool {
  method to_local (line 748) | fn to_local(&self) -> raw::Local {
  method from_local (line 752) | unsafe fn from_local(_env: Env, h: raw::Local) -> Self {
  type JsObject (line 781) | pub struct JsObject(raw::Local);
    method upcast_internal (line 86) | fn upcast_internal(v: &T) -> JsObject {
    method new (line 817) | pub fn new<'a, C: Context<'a>>(c: &mut C) -> Handle<'a, JsObject> {
    method new_internal (line 821) | pub(crate) fn new_internal<'a>(env: Env) -> Handle<'a, JsObject> {
    method build (line 825) | pub(crate) fn build<'a, F: FnOnce(&mut raw::Local)>(init: F) -> Handle...
  type Inner (line 786) | type Inner = raw::Local;
  method into_inner (line 788) | fn into_inner(self) -> Self::Inner {
  method name (line 794) | fn name() -> &'static str {
  method is_typeof (line 798) | fn is_typeof<Other: Value>(cx: &mut Cx, other: &Other) -> bool {
  method to_local (line 802) | fn to_local(&self) -> raw::Local {
  method from_local (line 806) | unsafe fn from_local(_env: Env, h: raw::Local) -> Self {
  type JsArray (line 858) | pub struct JsArray(raw::Local);
    method new (line 872) | pub fn new<'a, C: Context<'a>>(cx: &mut C, len: usize) -> Handle<'a, J...
    method new_internal (line 876) | pub(crate) fn new_internal<'a>(env: Env, len: usize) -> Handle<'a, JsA...
    method to_vec (line 889) | pub fn to_vec<'a, C: Context<'a>>(&self, cx: &mut C) -> NeonResult<Vec...
    method len_inner (line 903) | fn len_inner(&self, env: Env) -> u32 {
    method len (line 910) | pub fn len<'a, C: Context<'a>>(&self, cx: &mut C) -> u32 {
    method is_empty (line 916) | pub fn is_empty<'a, C: Context<'a>>(&self, cx: &mut C) -> bool {
  type Inner (line 924) | type Inner = raw::Local;
  method into_inner (line 926) | fn into_inner(self) -> Self::Inner {
  method name (line 932) | fn name() -> &'static str {
  method is_typeof (line 936) | fn is_typeof<Other: Value>(cx: &mut Cx, other: &Other) -> bool {
  method to_local (line 940) | fn to_local(&self) -> raw::Local {
  method from_local (line 944) | unsafe fn from_local(_env: Env, h: raw::Local) -> Self {
  type JsFunction (line 1024) | pub struct JsFunction {
    method new (line 1033) | pub fn new<'a, C, U>(
    method new (line 1048) | pub fn new<'a, C, F, V>(cx: &mut C, f: F) -> JsResult<'a, JsFunction>
    method with_name (line 1061) | pub fn with_name<'a, C, U>(
    method with_name (line 1075) | pub fn with_name<'a, C, F, V>(cx: &mut C, name: &str, f: F) -> JsResul...
    method new_internal (line 1084) | fn new_internal<'a, C, F, V>(cx: &mut C, f: F, name: &str) -> JsResult...
    method call (line 1126) | pub fn call<'a, 'b, C: Context<'a>, T, AS>(
    method exec (line 1142) | pub fn exec<'a, 'b, C: Context<'a>, T, AS>(
    method construct (line 1159) | pub fn construct<'a, 'b, C: Context<'a>, AS>(
    method bind (line 1190) | pub fn bind<'a, 'cx: 'a>(&self, cx: &'a mut Cx<'cx>) -> BindOptions<'a...
    method call_with (line 1204) | pub fn call_with<'a, C: Context<'a>>(&self, _cx: &C) -> CallOptions<'a> {
    method construct_with (line 1219) | pub fn construct_with<'a, C: Context<'a>>(&self, _cx: &C) -> Construct...
    method clone (line 1232) | unsafe fn clone(&self) -> Self {
  type Inner (line 1240) | type Inner = raw::Local;
  method into_inner (line 1242) | fn into_inner(self) -> Self::Inner {
  method name (line 1248) | fn name() -> &'static str {
  method is_typeof (line 1252) | fn is_typeof<Other: Value>(cx: &mut Cx, other: &Other) -> bool {
  method to_local (line 1256) | fn to_local(&self) -> raw::Local {
  method from_local (line 1260) | unsafe fn from_local(_env: Env, h: raw::Local) -> Self {
  type JsBigInt (line 1298) | pub struct JsBigInt(raw::Local);

FILE: crates/neon/src/types_impl/private.rs
  constant V8_ARGC_LIMIT (line 17) | const V8_ARGC_LIMIT: usize = 65535;
  function prepare_call (line 19) | pub(crate) unsafe fn prepare_call<'a, 'b, C: Context<'a>>(
  type ValueInternal (line 34) | pub trait ValueInternal: TransparentNoCopyWrapper + 'static {
    method name (line 35) | fn name() -> &'static str;
    method is_typeof (line 37) | fn is_typeof<Other: Value>(cx: &mut Cx, other: &Other) -> bool;
    method downcast (line 39) | fn downcast<Other: Value>(cx: &mut Cx, other: &Other) -> Option<Self> {
    method cast (line 49) | fn cast<'a, T: Value, F: FnOnce(raw::Local) -> T>(self, f: F) -> Handl...
    method to_local (line 53) | fn to_local(&self) -> raw::Local;
    method from_local (line 57) | unsafe fn from_local(env: Env, h: raw::Local) -> Self;
    method try_call (line 59) | unsafe fn try_call<'a, 'b, C: Context<'a>, T, AS>(
    method try_construct (line 91) | unsafe fn try_construct<'a, 'b, C: Context<'a>, AS>(
  function check_call_status (line 115) | unsafe fn check_call_status<'a, C: Context<'a>>(

FILE: crates/neon/src/types_impl/promise.rs
  constant BOUNDARY (line 42) | const BOUNDARY: FailureBoundary = FailureBoundary {
  type JsPromise (line 139) | pub struct JsPromise(raw::Local);
    method new (line 142) | pub(crate) fn new<'a, C: Context<'a>>(cx: &mut C) -> (Deferred, Handle...
    method resolve (line 158) | pub fn resolve<'a, C: Context<'a>, T: Value>(cx: &mut C, value: Handle...
    method reject (line 165) | pub fn reject<'a, C: Context<'a>, E: Value>(cx: &mut C, err: Handle<E>...
    method to_future (line 180) | pub fn to_future<'a, O, C, F>(&self, cx: &mut C, f: F) -> NeonResult<J...
  type Inner (line 246) | type Inner = raw::Local;
  method into_inner (line 248) | fn into_inner(self) -> Self::Inner {
  method name (line 254) | fn name() -> &'static str {
  method is_typeof (line 258) | fn is_typeof<Other: Value>(cx: &mut Cx, other: &Other) -> bool {
  method to_local (line 262) | fn to_local(&self) -> raw::Local {
  method from_local (line 266) | unsafe fn from_local(_env: Env, h: raw::Local) -> Self {
  type Deferred (line 287) | pub struct Deferred {
    method resolve (line 295) | pub fn resolve<'a, V, C>(self, cx: &mut C, value: Handle<V>)
    method reject (line 306) | pub fn reject<'a, V, C>(self, cx: &mut C, value: Handle<V>)
    method try_settle_with (line 325) | pub fn try_settle_with<V, F>(
    method settle_with (line 358) | pub fn settle_with<V, F>(self, channel: &Channel, complete: F) -> Join...
    method try_settle (line 374) | pub fn try_settle<V, T>(self, channel: &Channel, v: T) -> Result<JoinH...
    method settle (line 399) | pub fn settle<V, T>(self, channel: &Channel, v: T) -> JoinHandle<()>
    method try_catch_settle (line 407) | pub(crate) fn try_catch_settle<'a, C, V, F>(self, cx: C, f: F)
    method into_inner (line 425) | pub(crate) fn into_inner(mut self) -> sys::Deferred {
  type NodeApiDeferred (line 431) | pub(crate) struct NodeApiDeferred(sys::Deferred);
    method leaked (line 437) | pub(crate) unsafe fn leaked(self, env: raw::Env) {
  method drop (line 448) | fn drop(&mut self) {
  method drop (line 468) | fn drop(&mut self) {
  type JsFuture (line 558) | pub struct JsFuture<T> {
  type Output (line 566) | type Output = Result<T, JoinError>;
  method poll (line 568) | fn poll(mut self: Pin<&mut Self>, cx: &mut task::Context) -> Poll<Self::...

FILE: crates/neon/src/types_impl/utf8.rs
  constant SMALL_MAX (line 3) | const SMALL_MAX: usize = i32::MAX as usize;
  type SmallUtf8 (line 8) | pub struct SmallUtf8<'a> {
  function lower (line 13) | pub fn lower(&self) -> (*const u8, i32) {
  type Utf8 (line 20) | pub struct Utf8<'a> {
  function from (line 25) | fn from(s: &'a str) -> Self {
  function size (line 33) | pub fn size(&self) -> usize {
  function into_small (line 37) | pub fn into_small(self) -> Option<SmallUtf8<'a>> {
  function into_small_unwrap (line 47) | pub fn into_small_unwrap(self) -> SmallUtf8<'a> {
  function truncate (line 54) | pub fn truncate(self) -> SmallUtf8<'a> {

FILE: pkgs/cargo-cp-artifact/src/args.js
  class ParseError (line 3) | class ParseError extends Error {}
  constant NPM_ENV (line 5) | const NPM_ENV = "npm_package_name";
  constant EXPECTED_COMMAND (line 6) | const EXPECTED_COMMAND = [
  function validateArtifactType (line 15) | function validateArtifactType(artifactType) {
  function getArtifactName (line 32) | function getArtifactName({ artifactType, crateName }) {
  function getCrateNameFromEnv (line 36) | function getCrateNameFromEnv(env) {
  function parse (line 57) | function parse(argv, env) {

FILE: pkgs/cargo-cp-artifact/src/index.js
  function run (line 12) | function run(argv, env) {
  function processCargoBuildLine (line 66) | function processCargoBuildLine(options, copied, line) {
  function getOutputFiles (line 103) | function getOutputFiles(kind, name, artifacts) {
  function isNewer (line 121) | async function isNewer(filename, outputFile) {
  function copyArtifact (line 132) | async function copyArtifact(filename, outputFile) {
  function parseArgs (line 165) | function parseArgs(argv, env) {
  function quitError (line 177) | function quitError(msg) {

FILE: pkgs/create-neon/dev/expect.ts
  function splitLines (line 6) | function splitLines(s: string): string[] {
  function isCompleteLine (line 10) | function isCompleteLine(s: string): boolean {
  class LinesBuffer (line 14) | class LinesBuffer {
    method constructor (line 20) | constructor() {
    method add (line 24) | add(lines: string[]) {
    method find (line 38) | find(p: (s: string) => boolean): string[] | null {
  type Pattern (line 51) | interface Pattern {
  type QA (line 55) | type QA = { q: string; a: string };
  class ExpectLine (line 57) | class ExpectLine implements Pattern {
    method constructor (line 61) | constructor(optional: QA[], required: QA) {
    method expect (line 66) | async *expect(session: Session): AsyncGenerator<string[]> {
  class ExpectEOF (line 105) | class ExpectEOF implements Pattern {
    method constructor (line 108) | constructor(optional: QA[]) {
    method expect (line 113) | async *expect(session: Session): AsyncGenerator<string[]> {
  class Script (line 118) | class Script {
    method constructor (line 121) | constructor(src: Record<string, string>) {
    method run (line 147) | async *run(session: Session): AsyncGenerator<string[]> {
  class Session (line 156) | class Session {
    method constructor (line 161) | constructor(stdin: Writable, stdout: Readable) {
  function exit (line 168) | function exit(child: ChildProcess): Promise<number | null> {
  function expect (line 179) | async function expect(

FILE: pkgs/create-neon/src/bin/create-neon.ts
  constant OPTIONS (line 18) | const OPTIONS = [
  function parsePlatforms (line 82) | function parsePlatforms(
  function parseCI (line 107) | function parseCI(ci: string): CI | undefined {
  function parseCache (line 120) | function parseCache(

FILE: pkgs/create-neon/src/cache.ts
  type Cache (line 1) | interface Cache {

FILE: pkgs/create-neon/src/cache/npm.ts
  class NPM (line 3) | class NPM implements Cache {
    method constructor (line 9) | constructor(org: string, prefix: string) {

FILE: pkgs/create-neon/src/ci.ts
  type CI (line 1) | interface CI {

FILE: pkgs/create-neon/src/ci/github.ts
  constant TEMPLATES (line 5) | const TEMPLATES: Record<string, string> = {
  function githubDelegate (line 13) | function githubDelegate(
  class GitHub (line 20) | class GitHub implements CI {
    method constructor (line 21) | constructor() {}
    method templates (line 25) | templates(): Record<string, string> {
    method setup (line 29) | setup(): void {
    method scripts (line 33) | scripts(): Record<string, string> {

FILE: pkgs/create-neon/src/create/app.ts
  class AppCreator (line 3) | class AppCreator extends Creator {
    method constructor (line 4) | constructor(options: ProjectOptions) {
    method scripts (line 8) | scripts(): Record<string, string> {

FILE: pkgs/create-neon/src/create/creator.ts
  type Lang (line 12) | enum Lang {
  type ModuleType (line 18) | enum ModuleType {
  type LibraryOptions (line 23) | type LibraryOptions = {
  type ProjectOptions (line 31) | type ProjectOptions = {
  function stripNpmNamespace (line 43) | function stripNpmNamespace(pkg: string): string {
  method for (line 52) | static async for(options: ProjectOptions): Promise<Creator> {
  method constructor (line 62) | constructor(options: ProjectOptions) {
  method create (line 66) | async create(cx: Context): Promise<void> {
  method createNeonBoilerplate (line 137) | async createNeonBoilerplate(cx: Context): Promise<void> {
  method prepare (line 146) | async prepare(cx: Context): Promise<void> {
  method templates (line 155) | templates(_pkg: string): Record<string, string> {
  method scripts (line 164) | scripts(): Record<string, string> {
  method baseTemplate (line 168) | baseTemplate(): string {

FILE: pkgs/create-neon/src/create/lib.ts
  constant TS_TEMPLATES (line 12) | const TS_TEMPLATES: Record<string, string> = {
  class LibCreator (line 19) | class LibCreator extends Creator {
    method constructor (line 22) | constructor(options: ProjectOptions) {
    method templates (line 30) | templates(pkg: string): Record<string, string> {
    method createNeonBoilerplate (line 42) | async createNeonBoilerplate(cx: Context): Promise<void> {
    method createTSBoilerplate (line 56) | async createTSBoilerplate(cx: Context): Promise<void> {
    method createCIBoilerplate (line 63) | async createCIBoilerplate(cx: Context): Promise<void> {
    method addPlatforms (line 71) | async addPlatforms(cx: Context): Promise<void> {
    method scripts (line 93) | scripts(): Record<string, string> {
    method baseTemplate (line 116) | baseTemplate(): string {

FILE: pkgs/create-neon/src/die.ts
  function deleteNeonDir (line 3) | function deleteNeonDir(dir: string): Promise<void> {
  function die (line 7) | async function die(

FILE: pkgs/create-neon/src/expand/context.ts
  type ManifestData (line 4) | type ManifestData = {
  type CrateData (line 12) | type CrateData = ManifestData & {
  class Context (line 18) | class Context {
    method constructor (line 24) | constructor(options: ProjectOptions) {

FILE: pkgs/create-neon/src/expand/index.ts
  constant TEMPLATES_DIR (line 7) | const TEMPLATES_DIR = new URL(
  constant COMPARISON_HELPERS (line 12) | const COMPARISON_HELPERS = helpers("comparison");
  function expand (line 16) | async function expand(source: string, cx: Context): Promise<string> {
  function expandTo (line 22) | async function expandTo(source: string, target: string, cx: Context) {

FILE: pkgs/create-neon/src/expand/versions.ts
  type Versions (line 14) | type Versions = {
  constant KEYS (line 40) | const KEYS = [
  function assertIsVersions (line 51) | function assertIsVersions(data: unknown): asserts data is Versions {
  function load (line 64) | function load(): Versions {
  constant VERSIONS (line 70) | const VERSIONS: Versions = load();

FILE: pkgs/create-neon/src/fs.ts
  function assertCanMkdir (line 5) | async function assertCanMkdir(dir: string) {
  function mktemp (line 12) | async function mktemp(): Promise<string> {

FILE: pkgs/create-neon/src/index.ts
  constant CREATE_NEON_PRELUDE (line 15) | const CREATE_NEON_PRELUDE: string = `
  function askProjectType (line 27) | async function askProjectType(options: ProjectOptions) {
  function createNeon (line 102) | async function createNeon(options: ProjectOptions): Promise<void> {

FILE: pkgs/create-neon/src/print.ts
  function pink (line 4) | function pink(text: string): string {
  function green (line 8) | function green(text: string): string {
  function blue (line 12) | function blue(text: string): string {
  function yellow (line 16) | function yellow(text: string): string {
  function bold (line 20) | function bold(text: string): string {
  function mainUsage (line 24) | function mainUsage(): string {
  function printMainUsage (line 91) | function printMainUsage() {
  function printErrorWithUsage (line 95) | function printErrorWithUsage(e: any) {
  function printError (line 101) | function printError(e: any) {

FILE: pkgs/create-neon/src/shell.ts
  function readChunks (line 8) | function readChunks(input: Readable): Readable {
  type NpmInitExit (line 25) | type NpmInitExit = {
  class NpmInitProcess (line 35) | class NpmInitProcess {
    method constructor (line 39) | constructor(interactive: boolean, args: string[], cwd: string, tmp: st...
    method exit (line 49) | exit(): Promise<NpmInitExit> {
    method filterStdout (line 60) | async filterStdout(opts: { interactive: boolean }) {
  constant NPM_INIT_KEYS (line 94) | const NPM_INIT_KEYS = [
  function sort (line 104) | function sort(json: any): any {
  function npmInit (line 114) | async function npmInit(
  type Parser (line 138) | type Parser<T> = (v: string) => T;
  function oneOf (line 140) | function oneOf<T extends {}>(opts: T): Parser<T[keyof T]> {
  type Question (line 151) | interface Question<T> {
  class Dialog (line 158) | class Dialog {
    method constructor (line 161) | constructor() {
    method rl (line 168) | private rl(): readline.Interface {
    method end (line 175) | end() {
    method ask (line 180) | async ask<T>(opts: Question<T>): Promise<T> {

FILE: pkgs/create-neon/test/create-neon.ts
  constant NODE (line 10) | const NODE: string = process.execPath;
  constant CREATE_NEON (line 11) | const CREATE_NEON = fileURLToPath(
  constant PROJECT (line 35) | const PROJECT = "create-neon-test-project";
  constant NAMESPACED_PROJECT (line 36) | const NAMESPACED_PROJECT = "@dherman/create-neon-test-project";

FILE: test/electron/main.js
  function createWindow (line 5) | function createWindow() {

FILE: test/electron/src/lib.rs
  function hello (line 3) | fn hello(mut cx: FunctionContext) -> JsResult<JsString> {
  function main (line 8) | fn main(mut cx: ModuleContext) -> NeonResult<()> {

FILE: test/napi/lib/boxed.js
  class Person (line 5) | class Person {
    method constructor (line 6) | constructor(name) {
    method greet (line 10) | greet() {
  class RefPerson (line 15) | class RefPerson {
    method constructor (line 16) | constructor(name) {
    method greet (line 20) | greet() {
    method setName (line 24) | setName(name) {
    method fail (line 30) | fail() {

FILE: test/napi/lib/class.js
  class LoudMessage (line 122) | class LoudMessage extends Message {
    method shout (line 123) | shout() {

FILE: test/napi/lib/export.js
  function globals (line 11) | function globals() {
  function functions (line 28) | function functions() {
  function classes (line 123) | function classes() {

FILE: test/napi/lib/functions.js
  constant SLOPPY (line 8) | const SLOPPY = Function("return this;");
  function isStrict (line 10) | function isStrict(f) {
  function MyClass (line 86) | function MyClass(number, string) {

FILE: test/napi/lib/futures.js
  function assertRejects (line 5) | async function assertRejects(f, ...args) {

FILE: test/napi/lib/objects.js
  method nullary (line 105) | nullary() {
  method unary (line 108) | unary(x) {
  method [sym] (line 120) | [sym]() {
  method setName (line 145) | setName(name) {
  method toString (line 148) | toString() {

FILE: test/napi/lib/typedarrays.js
  constant DETACH_WORKER (line 17) | const DETACH_WORKER = new Worker(__filename);
  function detach (line 23) | function detach(buffer) {
  function testDetach (line 442) | function testDetach(

FILE: test/napi/lib/types.js
  class SubclassError (line 43) | class SubclassError extends Error {}

FILE: test/napi/src/js/arrays.rs
  function return_js_array (line 3) | pub fn return_js_array(mut cx: FunctionContext) -> JsResult<JsArray> {
  function return_js_array_with_number (line 7) | pub fn return_js_array_with_number(mut cx: FunctionContext) -> JsResult<...
  function return_js_array_with_string (line 14) | pub fn return_js_array_with_string(mut cx: FunctionContext) -> JsResult<...
  function read_js_array (line 21) | pub fn read_js_array(mut cx: FunctionContext) -> JsResult<JsValue> {

FILE: test/napi/src/js/bigint.rs
  function panic_catch (line 16) | fn panic_catch<'cx, F, C>(cx: &mut C, f: F) -> JsResult<'cx, JsFunction>
  function export (line 37) | fn export<F>(cx: &mut FunctionContext, o: &JsObject, f: F) -> NeonResult...
  function export_lossy (line 49) | fn export_lossy<T, F>(cx: &mut FunctionContext, o: &JsObject, f: F) -> N...
  function eval (line 68) | fn eval<'cx, C>(cx: &mut C, script: &str) -> JsResult<'cx, JsValue>
  function strict_eq (line 78) | fn strict_eq<'cx, L, R, C>(l: Handle<'cx, L>, r: Handle<'cx, R>, cx: &mu...
  function assert_eq (line 95) | fn assert_eq<'cx, L, R, C>(l: L, r: R, cx: &mut C) -> NeonResult<()>
  function bigint (line 109) | fn bigint<'cx, C>(cx: &mut C, n: &str) -> JsResult<'cx, JsBigInt>
  function to_bigint (line 136) | fn to_bigint<'cx, V, C>(b: Handle<V>, cx: &mut C) -> NeonResult<BigInt>
  function test_from_u64 (line 150) | fn test_from_u64(cx: &mut FunctionContext) -> NeonResult<()> {
  function test_from_i64 (line 162) | fn test_from_i64(cx: &mut FunctionContext) -> NeonResult<()> {
  function test_from_u128 (line 182) | fn test_from_u128(cx: &mut FunctionContext) -> NeonResult<()> {
  function test_from_i128 (line 201) | fn test_from_i128(cx: &mut FunctionContext) -> NeonResult<()> {
  function test_from_digits_le (line 233) | fn test_from_digits_le(cx: &mut FunctionContext) -> NeonResult<()> {
  function test_to_u64 (line 265) | fn test_to_u64(cx: &mut FunctionContext) -> NeonResult<()> {
  function test_to_i64 (line 278) | fn test_to_i64(cx: &mut FunctionContext) -> NeonResult<()> {
  function test_to_u128 (line 302) | fn test_to_u128(cx: &mut FunctionContext) -> NeonResult<()> {
  function test_to_i128 (line 330) | fn test_to_i128(cx: &mut FunctionContext) -> NeonResult<()> {
  function test_to_digits_le (line 362) | fn test_to_digits_le(cx: &mut FunctionContext) -> NeonResult<()> {
  function test_very_large_number (line 408) | fn test_very_large_number(cx: &mut FunctionContext) -> NeonResult<()> {
  function test_i64_out_of_range (line 436) | fn test_i64_out_of_range(cx: &mut FunctionContext) -> NeonResult<Result<...
  function test_u64_out_of_range (line 440) | fn test_u64_out_of_range(cx: &mut FunctionContext) -> NeonResult<Result<...
  function test_i128_extra_digits (line 444) | fn test_i128_extra_digits(cx: &mut FunctionContext) -> NeonResult<Result...
  function test_i128_overflow (line 452) | fn test_i128_overflow(cx: &mut FunctionContext) -> NeonResult<Result<i12...
  function test_i128_underflow (line 460) | fn test_i128_underflow(cx: &mut FunctionContext) -> NeonResult<Result<i1...
  function test_u128_overflow (line 468) | fn test_u128_overflow(cx: &mut FunctionContext) -> NeonResult<Result<i12...
  function test_u128_underflow (line 476) | fn test_u128_underflow(cx: &mut FunctionContext) -> NeonResult<Result<u1...
  function bigint_suite (line 486) | pub fn bigint_suite(mut cx: FunctionContext) -> JsResult<JsObject> {

FILE: test/napi/src/js/boxed.rs
  type Person (line 5) | pub struct Person {
    method new (line 12) | fn new(name: impl ToString) -> Self {
    method greet (line 18) | fn greet(&self) -> String {
    method set_name (line 22) | fn set_name(&mut self, name: impl ToString) {
  function person_new (line 27) | pub fn person_new(mut cx: FunctionContext) -> JsResult<JsBox<Person>> {
  function person_greet (line 34) | pub fn person_greet(mut cx: FunctionContext) -> JsResult<JsString> {
  function ref_person_new (line 41) | pub fn ref_person_new(mut cx: FunctionContext) -> JsResult<JsValue> {
  function ref_person_greet (line 48) | pub fn ref_person_greet(mut cx: FunctionContext) -> JsResult<JsString> {
  function ref_person_set_name (line 55) | pub fn ref_person_set_name(mut cx: FunctionContext) -> JsResult<JsUndefi...
  function ref_person_fail (line 64) | pub fn ref_person_fail(mut cx: FunctionContext) -> JsResult<JsUndefined> {
  function external_unit (line 72) | pub fn external_unit(mut cx: FunctionContext) -> JsResult<JsBox<()>> {
  function create_boxed_string (line 77) | fn create_boxed_string(s: String) -> Boxed<String> {
  function boxed_string_concat (line 82) | fn boxed_string_concat(Boxed(this): Boxed<String>, rhs: String) -> String {
  function boxed_string_repeat (line 88) | fn boxed_string_repeat(_cx: &mut FunctionContext, this: Boxed<String>, n...

FILE: test/napi/src/js/class.rs
  function wrap_string (line 6) | fn wrap_string(cx: &mut Cx, o: Handle<JsObject>, s: String) -> NeonResul...
  function unwrap_string (line 11) | fn unwrap_string(cx: &mut Cx, o: Handle<JsObject>) -> NeonResult<String> {
  type Message (line 18) | pub struct Message {
    method new (line 24) | pub fn new(value: String) -> Self {
    method read (line 28) | pub fn read(&self) -> &str {
    method concat (line 32) | pub fn concat(&self, other: &Self) -> Self {
    method append (line 38) | pub fn append(&mut self, suffix: String) {
    method finalize (line 42) | pub fn finalize<'a, C: Context<'a>>(self, _cx: &mut C) {
  type Point (line 48) | pub struct Point {
    constant ORIGIN_X (line 56) | const ORIGIN_X: u32 = 0;
    constant ORIGIN_Y (line 57) | const ORIGIN_Y: u32 = 0;
    constant MAX_COORD (line 61) | const MAX_COORD: u32 = 1000;
    constant DEFAULT_MESSAGE (line 65) | const DEFAULT_MESSAGE: &'static [&'static str] = &["hello", "point"];
    constant COMPUTED_VALUE (line 68) | const COMPUTED_VALUE: u32 = 10 + 20 + 12;
    constant SIZE_OF_F64 (line 69) | const SIZE_OF_F64: u32 = std::mem::size_of::<f64>() as u32;
    constant STRING_LENGTH (line 70) | const STRING_LENGTH: u32 = "complex".len() as u32;
    constant SELF_SIZE (line 73) | const SELF_SIZE: u32 = std::mem::size_of::<Self>() as u32;
    constant POINT_ALIGNMENT (line 74) | const POINT_ALIGNMENT: u32 = std::mem::align_of::<Point>() as u32;
    constant IS_2D (line 77) | const IS_2D: bool = true;
    constant MAX_DIMENSION (line 80) | const MAX_DIMENSION: u32 = if std::mem::size_of::<u32>() == 4 {
    constant COORDINATE_BYTES (line 87) | const COORDINATE_BYTES: u32 = match std::mem::size_of::<u32>() {
    constant DOUBLE_100_SQUARED (line 94) | const DOUBLE_100_SQUARED: u32 = 100_u32.pow(2) * 2;
    constant SPECIAL_CHARS (line 98) | const SPECIAL_CHARS: &'static str = "Hello\nWorld\t\"quoted\"\r\n";
    constant NEGATIVE_OFFSET (line 101) | const NEGATIVE_OFFSET: i32 = -42;
    constant MAX_SAFE_INTEGER_APPROX (line 104) | const MAX_SAFE_INTEGER_APPROX: u32 = 2147483647;
    constant _PRIVATE_CONST (line 107) | const _PRIVATE_CONST: u32 = 999;
    method new (line 109) | pub fn new(x: u32, y: u32) -> Self {
    method x (line 113) | pub fn x(&self) -> u32 {
    method y (line 117) | pub fn y(&self) -> u32 {
    method distance (line 121) | pub fn distance(&self, other: &Self) -> f64 {
    method midpoint (line 127) | pub fn midpoint(&self, other: &Self) -> Self {
    method swap_coords (line 134) | pub fn swap_coords(&mut self, other: &mut Self) {
    method move_by (line 139) | pub fn move_by(&mut self, dx: u32, dy: u32) {
    method set_x (line 144) | pub fn set_x(&mut self, x: u32) {
    method set_y (line 148) | pub fn set_y(&mut self, y: u32) {
  type StringBuffer (line 154) | pub struct StringBuffer {
    method push (line 160) | pub fn push(&mut self, s: String) {
    method to_string (line 165) | pub fn to_string(&self) -> String {
    method contains (line 170) | pub fn contains(&self, s: String) -> bool {
    method trim_start (line 175) | pub fn trim_start(&self) -> String {
    method trim_end (line 179) | pub fn trim_end(&self) -> String {
  type AsyncClass (line 186) | pub struct AsyncClass {
    constant DEFAULT_TIMEOUT (line 193) | const DEFAULT_TIMEOUT: u32 = 5000;
    constant VERSION_NUMBERS (line 197) | const VERSION_NUMBERS: &'static [u32] = &[1, 0, 0];
    method new (line 199) | pub fn new(value: String) -> Self {
    method async_method (line 209) | pub async fn async_method(self, suffix: String) -> String {
    method heavy_computation (line 216) | pub fn heavy_computation(self) -> u32 {
    method sync_method (line 226) | pub fn sync_method(&self) -> String {
    method json_method (line 232) | pub fn json_method(&self, data: Vec<String>) -> HashMap<String, String> {
    method explicit_async_method (line 245) | pub fn explicit_async_method(&self, multiplier: i32) -> impl Future<Ou...
    method explicit_async_clone (line 258) | pub fn explicit_async_clone(&self, suffix: String) -> impl Future<Outp...
    method method_with_context (line 266) | pub fn method_with_context<'a>(
    method method_with_explicit_context (line 277) | pub fn method_with_explicit_context(&self, _ctx: &mut Cx, suffix: Stri...
    method task_with_channel (line 283) | pub fn task_with_channel(self, _ch: Channel, multiplier: i32) -> String {
    method async_fn_with_channel (line 289) | pub async fn async_fn_with_channel(self, _ch: Channel, suffix: String)...
    method method_with_this (line 296) | pub fn method_with_this(&self, this: Handle<JsObject>, data: String) -...
    method method_with_explicit_this (line 306) | pub fn method_with_explicit_this(&self, _js_obj: Handle<JsObject>, suf...
    method method_with_context_and_this (line 312) | pub fn method_with_context_and_this<'a>(
    method simple_method (line 323) | pub fn simple_method(&self, x: i32) -> i32 {
    method json_method_perf (line 328) | pub fn json_method_perf(&self, data: Vec<i32>) -> Vec<i32> {
    method context_method_perf (line 332) | pub fn context_method_perf(&self, _cx: &mut FunctionContext, x: i32) -...
    method explicit_async_json_method (line 338) | pub fn explicit_async_json_method(
    method async_json_method (line 350) | pub async fn async_json_method(self, data: Vec<i32>) -> Vec<i32> {
  function create_point_from_rust (line 357) | pub fn create_point_from_rust(x: u32, y: u32) -> Point {
  function create_point_origin (line 363) | pub fn create_point_origin() -> Point {
  function double_point_coords (line 369) | pub fn double_point_coords(point: Point) -> Point {
  type FallibleCounter (line 375) | pub struct FallibleCounter {
    method new (line 381) | pub fn new(value: u32) -> Result<Self, String> {
    method get (line 389) | pub fn get(&self) -> u32 {
    method increment (line 393) | pub fn increment(&mut self) {
  type ContextCounter (line 400) | pub struct ContextCounter {
    method new (line 409) | pub fn new(_cx: &mut AlsoCx, value: u32) -> Self {
    method get (line 415) | pub fn get(&self) -> u32 {
  type AlsoCx (line 404) | type AlsoCx<'cx> = Cx<'cx>;
  type JsonConfig (line 422) | pub struct JsonConfig {
    method new (line 431) | pub fn new(config: JsonConfig) -> Self {
    method name (line 435) | pub fn name(&self) -> String {
    method count (line 439) | pub fn count(&self) -> u32 {
    method enabled (line 443) | pub fn enabled(&self) -> bool {
  type ValidatedConfig (line 450) | pub struct ValidatedConfig {
    method new (line 458) | pub fn new(_cx: &mut Cx, config: ValidatedConfig) -> Result<Self, Stri...
    method name (line 469) | pub fn name(&self) -> String {
    method count (line 473) | pub fn count(&self) -> u32 {
  type Secret (line 478) | pub struct Secret {
    method new (line 484) | pub fn new(cx: &mut Cx, init: Handle<JsValue>) -> NeonResult<Self> {
    method reveal (line 500) | pub fn reveal(&self) -> String {
  type Argv (line 505) | pub struct Argv {
    method new (line 512) | pub fn new(cx: &mut Cx, args: Option<Vec<String>>) -> NeonResult<Self> {
    method len (line 527) | pub fn len(&self) -> u32 {
    method get (line 531) | pub fn get(&self, index: u32) -> Option<String> {
  constant CAROUSEL_MESSAGES (line 536) | const CAROUSEL_MESSAGES: [&str; 5] = [
  type Carousel (line 544) | pub struct Carousel {
    method new (line 550) | pub fn new() -> Self {
    method next (line 554) | pub fn next(&mut self) -> String {
  type Expando (line 562) | pub struct Expando;
    method new (line 566) | pub fn new(cx: &mut FunctionContext) -> NeonResult<Self> {
    method expando (line 572) | pub fn expando(self, cx: &mut FunctionContext) -> NeonResult<i32> {

FILE: test/napi/src/js/coercions.rs
  function to_string (line 3) | pub fn to_string(mut cx: FunctionContext) -> JsResult<JsString> {

FILE: test/napi/src/js/container.rs
  function create_string_ref_cell (line 10) | fn create_string_ref_cell(s: String) -> RefCell<String> {
  function read_string_ref_cell (line 15) | fn read_string_ref_cell(s: &RefCell<String>) -> String {
  function write_string_ref_cell (line 20) | fn write_string_ref_cell(s: &RefCell<String>, value: String) {
  function string_ref_cell_concat (line 25) | fn string_ref_cell_concat(lhs: &RefCell<String>, rhs: String) -> String {
  function string_ref_concat (line 30) | fn string_ref_concat(lhs: Ref<String>, rhs: String) -> String {
  function write_string_ref (line 35) | fn write_string_ref(mut s: RefMut<String>, value: String) {
  function borrow_and_then (line 40) | fn borrow_and_then<'cx>(
  function borrow_mut_and_then (line 51) | fn borrow_mut_and_then<'cx>(
  function create_string_rc (line 63) | fn create_string_rc(s: String) -> Rc<String> {
  function read_string_rc (line 68) | fn read_string_rc(s: Rc<String>) -> String {
  function create_string_arc (line 73) | fn create_string_arc(s: String) -> Arc<String> {
  function read_string_arc (line 78) | fn read_string_arc(s: Arc<String>) -> String {

FILE: test/napi/src/js/date.rs
  function create_date (line 3) | pub fn create_date(mut cx: FunctionContext) -> JsResult<JsDate> {
  function create_date_from_value (line 8) | pub fn create_date_from_value(mut cx: FunctionContext) -> JsResult<JsDat...
  function check_date_is_valid (line 14) | pub fn check_date_is_valid(mut cx: FunctionContext) -> JsResult<JsBoolea...
  function try_new_date (line 21) | pub fn try_new_date(mut cx: FunctionContext) -> JsResult<JsUndefined> {
  function try_new_lossy_date (line 29) | pub fn try_new_lossy_date(mut cx: FunctionContext) -> JsResult<JsUndefin...
  function nan_dates (line 43) | pub fn nan_dates(mut cx: FunctionContext) -> JsResult<JsUndefined> {
  function check_date_is_invalid (line 55) | pub fn check_date_is_invalid(mut cx: FunctionContext) -> JsResult<JsBool...
  function create_and_get_invalid_date (line 63) | pub fn create_and_get_invalid_date(mut cx: FunctionContext) -> JsResult<...
  function get_date_value (line 89) | pub fn get_date_value(mut cx: FunctionContext) -> JsResult<JsNumber> {

FILE: test/napi/src/js/errors.rs
  function new_error (line 3) | pub fn new_error(mut cx: FunctionContext) -> JsResult<JsError> {
  function new_type_error (line 9) | pub fn new_type_error(mut cx: FunctionContext) -> JsResult<JsError> {
  function new_range_error (line 15) | pub fn new_range_error(mut cx: FunctionContext) -> JsResult<JsError> {
  function throw_error (line 21) | pub fn throw_error(mut cx: FunctionContext) -> JsResult<JsUndefined> {
  function downcast_error (line 27) | pub fn downcast_error(mut cx: FunctionContext) -> JsResult<JsString> {

FILE: test/napi/src/js/export.rs
  constant NUMBER (line 9) | const NUMBER: u8 = 42;
  function no_args_or_return (line 27) | fn no_args_or_return() {}
  function simple_add (line 30) | fn simple_add(a: f64, b: f64) -> f64 {
  function rs_renamed_add (line 35) | fn rs_renamed_add(a: f64, b: f64) -> f64 {
  function add_task (line 40) | fn add_task(a: f64, b: f64) -> f64 {
  function rs_renamed_add_task (line 45) | fn rs_renamed_add_task(a: f64, b: f64) -> f64 {
  function json_sort (line 50) | fn json_sort(mut items: Vec<String>) -> Vec<String> {
  function rs_renamed_json_sort (line 56) | fn rs_renamed_json_sort(items: Vec<String>) -> Vec<String> {
  function json_sort_task (line 61) | fn json_sort_task(items: Vec<String>) -> Vec<String> {
  function rs_renamed_json_sort_task (line 66) | fn rs_renamed_json_sort_task(items: Vec<String>) -> Vec<String> {
  function concat_with_cx_and_handle (line 71) | fn concat_with_cx_and_handle<'cx>(
  function fail_with_throw (line 82) | fn fail_with_throw(msg: String) -> Result<(), Error> {
  function sleep_task (line 94) | fn sleep_task(ms: f64) {
  function number_with_cx (line 101) | fn number_with_cx<'cx>(cx: &mut Cx<'cx>, n: f64) -> Handle<'cx, JsNumber> {
  function simple_self (line 106) | fn simple_self(this: Handle<JsObject>) -> Handle<JsObject> {
  function boxed_self (line 111) | fn boxed_self(Boxed(this): Boxed<String>) -> String {
  function boxed_string (line 116) | fn boxed_string(s: String) -> Boxed<String> {
  function add_i32 (line 121) | fn add_i32(a: i32, b: i32) -> i32 {
  function add_u32 (line 126) | fn add_u32(a: u32, b: u32) -> u32 {
  function to_i32 (line 131) | fn to_i32(n: i32) -> i32 {
  function to_u32 (line 136) | fn to_u32(n: u32) -> u32 {
  type ExportedPoint (line 142) | pub struct ExportedPoint {
    constant ORIGIN_X (line 149) | const ORIGIN_X: f64 = 0.0;
    constant ORIGIN_Y (line 150) | const ORIGIN_Y: f64 = 0.0;
    method new (line 152) | pub fn new(x: f64, y: f64) -> Self {
    method x (line 156) | pub fn x(&self) -> f64 {
    method y (line 160) | pub fn y(&self) -> f64 {
    method distance (line 164) | pub fn distance(&self, other: Self) -> f64 {
  type CustomNamedClass (line 173) | pub struct CustomNamedClass {
    method new (line 179) | pub fn new(value: String) -> Self {
    method get_value (line 183) | pub fn get_value(&self) -> String {
  type Case2Class (line 190) | pub struct Case2Class {
    method new (line 196) | pub fn new(message: String) -> Self {
    method get_message (line 200) | pub fn get_message(&self) -> String {
  type Case3Class (line 207) | pub struct Case3Class {
    method new (line 213) | pub fn new(data: i32) -> Self {
    method get_data (line 217) | pub fn get_data(&self) -> i32 {
  function export_async_json_test (line 224) | pub async fn export_async_json_test(data: Vec<i32>) -> Vec<i32> {

FILE: test/napi/src/js/extract.rs
  function extract_values (line 5) | pub fn extract_values(mut cx: FunctionContext) -> JsResult<JsArray> {
  function extract_buffer_sum (line 60) | pub fn extract_buffer_sum(mut cx: FunctionContext) -> JsResult<JsNumber> {
  function extract_json_sum (line 130) | pub fn extract_json_sum(mut cx: FunctionContext) -> JsResult<JsNumber> {
  function extract_single_add_one (line 136) | pub fn extract_single_add_one(mut cx: FunctionContext) -> JsResult<JsNum...
  function extract_json_option (line 143) | pub fn extract_json_option(maybe_x: Option<f64>) -> Option<f64> {
  function extract_either (line 148) | pub fn extract_either(either: Either<String, f64>) -> String {
  function buffer_concat (line 157) | pub fn buffer_concat(mut a: Vec<u8>, Uint8Array(b): Uint8Array<Vec<u8>>)...
  function string_to_buf (line 164) | pub fn string_to_buf(s: String) -> Uint8Array<String> {
  function sleep_with_js (line 171) | fn sleep_with_js(n: f64) -> impl for<'cx> TryIntoJs<'cx> {
  function sleep_with_js_sync (line 181) | fn sleep_with_js_sync(n: f64) -> impl for<'cx> TryIntoJs<'cx> {
  function sleep_with (line 187) | fn sleep_with(n: f64) -> impl for<'cx> TryIntoJs<'cx> {
  function sleep_with_sync (line 197) | fn sleep_with_sync(n: f64) -> impl for<'cx> TryIntoJs<'cx> {
  function extract_array_vec (line 202) | fn extract_array_vec(Array(arr): Array<Vec<f64>>) -> Array<Vec<f64>> {
  function extract_array_double (line 207) | fn extract_array_double(Array(arr): Array<Vec<f64>>) -> Array<impl Itera...
  function extract_array_dedupe (line 212) | fn extract_array_dedupe(set: Array<HashSet<String>>) -> Array<HashSet<St...

FILE: test/napi/src/js/functions.rs
  function add1 (line 3) | fn add1(mut cx: FunctionContext) -> JsResult<JsNumber> {
  function return_js_function (line 8) | pub fn return_js_function(mut cx: FunctionContext) -> JsResult<JsFunctio...
  function call_js_function (line 12) | pub fn call_js_function(mut cx: FunctionContext) -> JsResult<JsNumber> {
  function call_js_function_idiomatically (line 21) | pub fn call_js_function_idiomatically(mut cx: FunctionContext) -> JsResu...
  function call_js_function_with_bind (line 29) | pub fn call_js_function_with_bind(mut cx: FunctionContext) -> JsResult<J...
  function call_js_function_with_bind_and_args_with (line 40) | pub fn call_js_function_with_bind_and_args_with(mut cx: FunctionContext)...
  function call_js_function_with_bind_and_args_and_with (line 49) | pub fn call_js_function_with_bind_and_args_and_with(mut cx: FunctionCont...
  function call_parse_int_with_bind (line 60) | pub fn call_parse_int_with_bind(mut cx: FunctionContext) -> JsResult<JsN...
  function call_js_function_with_bind_and_exec (line 66) | pub fn call_js_function_with_bind_and_exec(mut cx: FunctionContext) -> J...
  function call_js_constructor_with_bind (line 71) | pub fn call_js_constructor_with_bind(mut cx: FunctionContext) -> JsResul...
  function bind_js_function_to_object (line 78) | pub fn bind_js_function_to_object(mut cx: FunctionContext) -> JsResult<J...
  function bind_js_function_to_number (line 85) | pub fn bind_js_function_to_number(mut cx: FunctionContext) -> JsResult<J...
  function get_math_max (line 90) | fn get_math_max<'a>(cx: &mut FunctionContext<'a>) -> JsResult<'a, JsFunc...
  function call_js_function_with_zero_args (line 96) | pub fn call_js_function_with_zero_args(mut cx: FunctionContext) -> JsRes...
  function call_js_function_with_one_arg (line 100) | pub fn call_js_function_with_one_arg(mut cx: FunctionContext) -> JsResul...
  function call_js_function_with_two_args (line 107) | pub fn call_js_function_with_two_args(mut cx: FunctionContext) -> JsResu...
  function call_js_function_with_three_args (line 115) | pub fn call_js_function_with_three_args(mut cx: FunctionContext) -> JsRe...
  function call_js_function_with_four_args (line 124) | pub fn call_js_function_with_four_args(mut cx: FunctionContext) -> JsRes...
  function call_js_function_with_custom_this (line 134) | pub fn call_js_function_with_custom_this(mut cx: FunctionContext) -> JsR...
  function call_js_function_with_implicit_this (line 144) | pub fn call_js_function_with_implicit_this(mut cx: FunctionContext) -> J...
  function exec_js_function_with_implicit_this (line 151) | pub fn exec_js_function_with_implicit_this(mut cx: FunctionContext) -> J...
  function call_js_function_with_heterogeneous_tuple (line 159) | pub fn call_js_function_with_heterogeneous_tuple(mut cx: FunctionContext...
  function construct_js_function (line 166) | pub fn construct_js_function(mut cx: FunctionContext) -> JsResult<JsNumb...
  function construct_js_function_idiomatically (line 178) | pub fn construct_js_function_idiomatically(mut cx: FunctionContext) -> J...
  function construct_js_function_with_overloaded_result (line 191) | pub fn construct_js_function_with_overloaded_result(mut cx: FunctionCont...
  function check_string_and_number (line 200) | pub fn check_string_and_number(mut cx: FunctionContext) -> JsResult<JsUn...
  function panic (line 206) | pub fn panic(_: FunctionContext) -> JsResult<JsUndefined> {
  function panic_after_throw (line 210) | pub fn panic_after_throw(mut cx: FunctionContext) -> JsResult<JsUndefine...
  function num_arguments (line 216) | pub fn num_arguments(mut cx: FunctionContext) -> JsResult<JsNumber> {
  function return_this (line 221) | pub fn return_this(mut cx: FunctionContext) -> JsResult<JsValue> {
  function require_object_this (line 225) | pub fn require_object_this(mut cx: FunctionContext) -> JsResult<JsUndefi...
  function is_argument_zero_some (line 232) | pub fn is_argument_zero_some(mut cx: FunctionContext) -> JsResult<JsBool...
  function require_argument_zero_string (line 237) | pub fn require_argument_zero_string(mut cx: FunctionContext) -> JsResult...
  function execute_scoped (line 242) | pub fn execute_scoped(mut cx: FunctionContext) -> JsResult<JsNumber> {
  function compute_scoped (line 253) | pub fn compute_scoped(mut cx: FunctionContext) -> JsResult<JsNumber> {
  function recompute_scoped (line 268) | pub fn recompute_scoped(mut cx: FunctionContext) -> JsResult<JsValue> {
  function throw_and_catch (line 274) | pub fn throw_and_catch(mut cx: FunctionContext) -> JsResult<JsValue> {
  function call_and_catch (line 284) | pub fn call_and_catch(mut cx: FunctionContext) -> JsResult<JsValue> {
  function get_number_or_default (line 291) | pub fn get_number_or_default(mut cx: FunctionContext) -> JsResult<JsNumb...
  function assume_this_is_an_object (line 299) | pub fn assume_this_is_an_object(mut cx: FunctionContext) -> JsResult<JsO...
  function is_construct (line 321) | pub fn is_construct(mut cx: FunctionContext) -> JsResult<JsObject> {
  function caller_with_drop_callback (line 337) | pub fn caller_with_drop_callback(mut cx: FunctionContext) -> JsResult<Js...

FILE: test/napi/src/js/futures.rs
  function lazy_async_add (line 16) | pub fn lazy_async_add(mut cx: FunctionContext) -> JsResult<JsPromise> {
  function lazy_async_sum (line 50) | pub fn lazy_async_sum(mut cx: FunctionContext) -> JsResult<JsPromise> {
  function async_fn_add (line 83) | async fn async_fn_add(a: f64, b: f64) -> f64 {
  function async_add (line 88) | fn async_add(a: f64, b: f64) -> impl Future<Output = f64> {
  function async_fn_div (line 93) | async fn async_fn_div(a: f64, b: f64) -> Result<f64, Error> {
  function async_div (line 102) | fn async_div(cx: &mut FunctionContext) -> NeonResult<impl Future<Output ...
  function async_with_events (line 115) | fn async_with_events(
  function await_callback (line 140) | async fn await_callback(ch: Channel, cb: Root<JsFunction>) -> Result<Roo...

FILE: test/napi/src/js/numbers.rs
  function return_js_number (line 3) | pub fn return_js_number(mut cx: FunctionContext) -> JsResult<JsNumber> {
  function return_large_js_number (line 7) | pub fn return_large_js_number(mut cx: FunctionContext) -> JsResult<JsNum...
  function return_negative_js_number (line 11) | pub fn return_negative_js_number(mut cx: FunctionContext) -> JsResult<Js...
  function return_float_js_number (line 15) | pub fn return_float_js_number(mut cx: FunctionContext) -> JsResult<JsNum...
  function return_negative_float_js_number (line 19) | pub fn return_negative_float_js_number(mut cx: FunctionContext) -> JsRes...
  function accept_and_return_js_number (line 23) | pub fn accept_and_return_js_number(mut cx: FunctionContext) -> JsResult<...
  function accept_and_return_large_js_number (line 28) | pub fn accept_and_return_large_js_number(mut cx: FunctionContext) -> JsR...
  function accept_and_return_float_js_number (line 33) | pub fn accept_and_return_float_js_number(mut cx: FunctionContext) -> JsR...
  function accept_and_return_negative_js_number (line 38) | pub fn accept_and_return_negative_js_number(mut cx: FunctionContext) -> ...

FILE: test/napi/src/js/objects.rs
  function return_js_global_object (line 5) | pub fn return_js_global_object(mut cx: FunctionContext) -> JsResult<JsOb...
  function return_js_object (line 9) | pub fn return_js_object(mut cx: FunctionContext) -> JsResult<JsObject> {
  function return_js_object_with_mixed_content (line 13) | pub fn return_js_object_with_mixed_content(mut cx: FunctionContext) -> J...
  function return_js_object_with_number (line 22) | pub fn return_js_object_with_number(mut cx: FunctionContext) -> JsResult...
  function return_js_object_with_string (line 29) | pub fn return_js_object_with_string(mut cx: FunctionContext) -> JsResult...
  function freeze_js_object (line 36) | pub fn freeze_js_object(mut cx: FunctionContext) -> JsResult<JsUndefined> {
  function seal_js_object (line 44) | pub fn seal_js_object(mut cx: FunctionContext) -> JsResult<JsUndefined> {
  function get_bytes (line 54) | fn get_bytes<'cx, 'a, C>(cx: &'a mut C, v: Handle<JsValue>) -> NeonResul...
  function byte_length (line 69) | pub fn byte_length(mut cx: FunctionContext) -> JsResult<JsNumber> {
  function call_nullary_method (line 80) | pub fn call_nullary_method(mut cx: FunctionContext) -> JsResult<JsNumber> {
  function call_unary_method (line 85) | pub fn call_unary_method(mut cx: FunctionContext) -> JsResult<JsNumber> {
  function call_symbol_method (line 93) | pub fn call_symbol_method(mut cx: FunctionContext) -> JsResult<JsString> {
  function get_property_with_prop (line 99) | pub fn get_property_with_prop(mut cx: FunctionContext) -> JsResult<JsNum...
  function set_property_with_prop (line 105) | pub fn set_property_with_prop(mut cx: FunctionContext) -> JsResult<JsUnd...
  function call_methods_with_prop (line 111) | pub fn call_methods_with_prop(mut cx: FunctionContext) -> JsResult<JsStr...
  function call_non_method_with_prop (line 120) | pub fn call_non_method_with_prop(mut cx: FunctionContext) -> JsResult<Js...

FILE: test/napi/src/js/strings.rs
  function return_js_string (line 3) | pub fn return_js_string(mut cx: FunctionContext) -> JsResult<JsString> {
  function return_js_string_utf16 (line 7) | pub fn return_js_string_utf16(mut cx: FunctionContext) -> JsResult<JsTyp...
  function return_length_utf8 (line 12) | pub fn return_length_utf8(mut cx: FunctionContext) -> JsResult<JsNumber> {
  function return_length_utf16 (line 17) | pub fn return_length_utf16(mut cx: FunctionContext) -> JsResult<JsNumber> {
  function run_string_as_script (line 22) | pub fn run_string_as_script(mut cx: FunctionContext) -> JsResult<JsValue> {

FILE: test/napi/src/js/threads.rs
  function useless_root (line 8) | pub fn useless_root(mut cx: FunctionContext) -> JsResult<JsObject> {
  function thread_callback (line 16) | pub fn thread_callback(mut cx: FunctionContext) -> JsResult<JsUndefined> {
  function multi_threaded_callback (line 27) | pub fn multi_threaded_callback(mut cx: FunctionContext) -> JsResult<JsUn...
  type BoxedGreeter (line 52) | type BoxedGreeter = JsBox<RefCell<AsyncGreeter>>;
  type AsyncGreeter (line 54) | pub struct AsyncGreeter {
    method greet (line 62) | fn greet<'a, C: Context<'a>>(&self, mut cx: C) -> JsResult<'a, JsUndef...
  method finalize (line 82) | fn finalize<'a, C: Context<'a>>(self, cx: &mut C) {
  function greeter_new (line 95) | pub fn greeter_new(mut cx: FunctionContext) -> JsResult<BoxedGreeter> {
  function greeter_greet (line 116) | pub fn greeter_greet(mut cx: FunctionContext) -> JsResult<JsUndefined> {
  function leak_channel (line 123) | pub fn leak_channel(mut cx: FunctionContext) -> JsResult<JsUndefined> {
  function drop_global_queue (line 135) | pub fn drop_global_queue(mut cx: FunctionContext) -> JsResult<JsUndefine...
  function channel_join (line 174) | pub fn channel_join(mut cx: FunctionContext) -> JsResult<JsUndefined> {
  function sum (line 217) | pub fn sum(mut cx: FunctionContext) -> JsResult<JsPromise> {
  function sum_manual_promise (line 227) | pub fn sum_manual_promise(mut cx: FunctionContext) -> JsResult<JsPromise> {
  function sum_rust_thread (line 242) | pub fn sum_rust_thread(mut cx: FunctionContext) -> JsResult<JsPromise> {
  function leak_promise (line 257) | pub fn leak_promise(mut cx: FunctionContext) -> JsResult<JsPromise> {
  function channel_panic (line 263) | pub fn channel_panic(mut cx: FunctionContext) -> JsResult<JsUndefined> {
  function channel_throw (line 276) | pub fn channel_throw(mut cx: FunctionContext) -> JsResult<JsUndefined> {
  function channel_panic_throw (line 290) | pub fn channel_panic_throw(mut cx: FunctionContext) -> JsResult<JsUndefi...
  type CustomPanic (line 308) | struct CustomPanic(String);
  function channel_custom_panic (line 310) | pub fn channel_custom_panic(mut cx: FunctionContext) -> JsResult<JsUndef...
  function custom_panic_downcast (line 323) | pub fn custom_panic_downcast(mut cx: FunctionContext) -> JsResult<JsStri...
  function task_panic_execute (line 329) | pub fn task_panic_execute(mut cx: FunctionContext) -> JsResult<JsUndefin...
  function task_panic_complete (line 337) | pub fn task_panic_complete(mut cx: FunctionContext) -> JsResult<JsUndefi...
  function task_throw (line 345) | pub fn task_throw(mut cx: FunctionContext) -> JsResult<JsUndefined> {
  function task_panic_throw (line 356) | pub fn task_panic_throw(mut cx: FunctionContext) -> JsResult<JsUndefined> {
  function task_custom_panic (line 371) | pub fn task_custom_panic(mut cx: FunctionContext) -> JsResult<JsUndefine...
  function task_reject_promise (line 380) | pub fn task_reject_promise(mut cx: FunctionContext) -> JsResult<JsPromis...
  function task_panic_execute_promise (line 389) | pub fn task_panic_execute_promise(mut cx: FunctionContext) -> JsResult<J...
  function task_panic_complete_promise (line 398) | pub fn task_panic_complete_promise(mut cx: FunctionContext) -> JsResult<...
  function task_panic_throw_promise (line 407) | pub fn task_panic_throw_promise(mut cx: FunctionContext) -> JsResult<JsP...
  function deferred_settle_with_throw (line 421) | pub fn deferred_settle_with_throw(mut cx: FunctionContext) -> JsResult<J...
  function deferred_settle_with_panic (line 437) | pub fn deferred_settle_with_panic(mut cx: FunctionContext) -> JsResult<J...
  function deferred_settle_with_panic_throw (line 451) | pub fn deferred_settle_with_panic_throw(mut cx: FunctionContext) -> JsRe...
  function block_task_callback (line 471) | fn block_task_callback(ch: Channel, cb: Root<JsFunction>) -> Result<Root...
  function settle_hello_world (line 487) | fn settle_hello_world<'cx>(cx: &mut Cx<'cx>) -> JsResult<'cx, JsPromise> {

FILE: test/napi/src/js/typedarrays.rs
  function return_array_buffer (line 6) | pub fn return_array_buffer(mut cx: FunctionContext) -> JsResult<JsArrayB...
  function return_array_buffer_from_slice (line 11) | pub fn return_array_buffer_from_slice(mut cx: FunctionContext) -> JsResu...
  function read_array_buffer_with_lock (line 18) | pub fn read_array_buffer_with_lock(mut cx: FunctionContext) -> JsResult<...
  function read_array_buffer_with_borrow (line 27) | pub fn read_array_buffer_with_borrow(mut cx: FunctionContext) -> JsResul...
  function write_array_buffer_with_lock (line 35) | pub fn write_array_buffer_with_lock(mut cx: FunctionContext) -> JsResult...
  function write_array_buffer_with_borrow_mut (line 50) | pub fn write_array_buffer_with_borrow_mut(mut cx: FunctionContext) -> Js...
  function read_typed_array_with_borrow (line 60) | pub fn read_typed_array_with_borrow(mut cx: FunctionContext) -> JsResult...
  function write_typed_array_with_borrow_mut (line 68) | pub fn write_typed_array_with_borrow_mut(mut cx: FunctionContext) -> JsR...
  function read_u8_typed_array (line 78) | pub fn read_u8_typed_array(mut cx: FunctionContext) -> JsResult<JsNumber> {
  function copy_typed_array (line 86) | pub fn copy_typed_array(mut cx: FunctionContext) -> JsResult<JsUndefined> {
  function return_uninitialized_buffer (line 104) | pub fn return_uninitialized_buffer(mut cx: FunctionContext) -> JsResult<...
  function return_buffer (line 109) | pub fn return_buffer(mut cx: FunctionContext) -> JsResult<JsBuffer> {
  function return_external_buffer (line 114) | pub fn return_external_buffer(mut cx: FunctionContext) -> JsResult<JsBuf...
  function return_external_array_buffer (line 121) | pub fn return_external_array_buffer(mut cx: FunctionContext) -> JsResult...
  function return_int8array_from_arraybuffer (line 128) | pub fn return_int8array_from_arraybuffer(mut cx: FunctionContext) -> JsR...
  function return_int16array_from_arraybuffer (line 133) | pub fn return_int16array_from_arraybuffer(mut cx: FunctionContext) -> Js...
  function return_uint32array_from_arraybuffer (line 138) | pub fn return_uint32array_from_arraybuffer(mut cx: FunctionContext) -> J...
  function return_float64array_from_arraybuffer (line 143) | pub fn return_float64array_from_arraybuffer(mut cx: FunctionContext) -> ...
  function return_biguint64array_from_arraybuffer (line 148) | pub fn return_biguint64array_from_arraybuffer(
  function return_new_int32array (line 155) | pub fn return_new_int32array(mut cx: FunctionContext) -> JsResult<JsInt3...
  function return_int32array_from_slice (line 160) | pub fn return_int32array_from_slice(mut cx: FunctionContext) -> JsResult...
  function return_uint32array_from_arraybuffer_region (line 172) | pub fn return_uint32array_from_arraybuffer_region(
  function get_arraybuffer_byte_length (line 183) | pub fn get_arraybuffer_byte_length(mut cx: FunctionContext) -> JsResult<...
  function typed_array_info (line 190) | fn typed_array_info<'cx, C, T: Binary>(
  function detach_and_then (line 219) | fn detach_and_then<'cx, F>(mut cx: FunctionContext<'cx>, f: F) -> JsResu...
  function detach_same_handle (line 247) | pub fn detach_same_handle(cx: FunctionContext) -> JsResult<JsObject> {
  function detach_and_escape (line 251) | pub fn detach_and_escape(cx: FunctionContext) -> JsResult<JsObject> {
  function detach_and_cast (line 258) | pub fn detach_and_cast(cx: FunctionContext) -> JsResult<JsObject> {
  function detach_and_unroot (line 266) | pub fn detach_and_unroot(cx: FunctionContext) -> JsResult<JsObject> {
  function get_typed_array_info (line 274) | pub fn get_typed_array_info(mut cx: FunctionContext) -> JsResult<JsObjec...
  function build_f32_region (line 302) | pub fn build_f32_region(mut cx: FunctionContext) -> JsResult<JsValue> {
  function build_f64_region (line 321) | pub fn build_f64_region(mut cx: FunctionContext) -> JsResult<JsValue> {
  function read_buffer_with_lock (line 340) | pub fn read_buffer_with_lock(mut cx: FunctionContext) -> JsResult<JsNumb...
  function read_buffer_with_borrow (line 352) | pub fn read_buffer_with_borrow(mut cx: FunctionContext) -> JsResult<JsNu...
  function write_buffer_with_lock (line 360) | pub fn write_buffer_with_lock(mut cx: FunctionContext) -> JsResult<JsUnd...
  function write_buffer_with_borrow_mut (line 373) | pub fn write_buffer_with_borrow_mut(mut cx: FunctionContext) -> JsResult...
  function copy_buffer (line 383) | pub fn copy_buffer(mut cx: FunctionContext) -> JsResult<JsUndefined> {
  function copy_buffer_with_borrow (line 396) | pub fn copy_buffer_with_borrow(mut cx: FunctionContext) -> JsResult<JsUn...

FILE: test/napi/src/js/types.rs
  function is_string (line 3) | pub fn is_string(mut cx: FunctionContext) -> JsResult<JsBoolean> {
  function is_array (line 9) | pub fn is_array(mut cx: FunctionContext) -> JsResult<JsBoolean> {
  function is_array_buffer (line 15) | pub fn is_array_buffer(mut cx: FunctionContext) -> JsResult<JsBoolean> {
  function is_uint32_array (line 21) | pub fn is_uint32_array(mut cx: FunctionContext) -> JsResult<JsBoolean> {
  function is_boolean (line 27) | pub fn is_boolean(mut cx: FunctionContext) -> JsResult<JsBoolean> {
  function is_buffer (line 33) | pub fn is_buffer(mut cx: FunctionContext) -> JsResult<JsBoolean> {
  function is_error (line 39) | pub fn is_error(mut cx: FunctionContext) -> JsResult<JsBoolean> {
  function is_null (line 45) | pub fn is_null(mut cx: FunctionContext) -> JsResult<JsBoolean> {
  function is_number (line 51) | pub fn is_number(mut cx: FunctionContext) -> JsResult<JsBoolean> {
  function is_object (line 57) | pub fn is_object(mut cx: FunctionContext) -> JsResult<JsBoolean> {
  function is_undefined (line 63) | pub fn is_undefined(mut cx: FunctionContext) -> JsResult<JsBoolean> {
  function strict_equals (line 69) | pub fn strict_equals(mut cx: FunctionContext) -> JsResult<JsBoolean> {

FILE: test/napi/src/js/workers.rs
  function get_and_replace (line 8) | pub fn get_and_replace(mut cx: FunctionContext) -> JsResult<JsValue> {
  function get_or_init (line 21) | pub fn get_or_init(mut cx: FunctionContext) -> JsResult<JsObject> {
  function get_or_init_clone (line 34) | pub fn get_or_init_clone(mut cx: FunctionContext) -> JsResult<JsObject> {
  function get_or_init_thread_id (line 51) | pub fn get_or_init_thread_id(mut cx: FunctionContext) -> JsResult<JsNumb...
  function reentrant_try_init (line 59) | pub fn reentrant_try_init(mut cx: FunctionContext) -> JsResult<JsNumber> {
  function get_reentrant_value (line 68) | pub fn get_reentrant_value(mut cx: FunctionContext) -> JsResult<JsValue> {
  function stash_global_object (line 78) | pub fn stash_global_object(mut cx: FunctionContext) -> JsResult<JsUndefi...
  function unstash_global_object (line 87) | pub fn unstash_global_object(mut cx: FunctionContext) -> JsResult<JsValu...
  function reject_after (line 94) | pub fn reject_after(mut cx: FunctionContext) -> JsResult<JsPromise> {
  type Channels (line 112) | pub struct Channels {
  function box_channels (line 118) | pub fn box_channels(mut cx: FunctionContext) -> JsResult<JsBox<Channels>> {

FILE: test/napi/src/lib.rs
  function main (line 33) | fn main(mut cx: ModuleContext) -> NeonResult<()> {
  function runtime (line 480) | fn runtime<'a, C: Context<'a>>(cx: &mut C) -> NeonResult<&'static Runtim...

FILE: test/rust-2024/src/lib.rs
  function hello (line 2) | fn hello() -> String {

FILE: test/ui/src/lib.rs
  function ui (line 3) | fn ui() {

FILE: test/ui/tests/fail/class-async-borrowed-channel.rs
  type Example (line 3) | struct Example;
    method method (line 8) | fn method(&self, _ch: &Channel) {}
  function main (line 11) | fn main() {}

FILE: test/ui/tests/fail/class-async-context-ref.rs
  type Example (line 3) | struct Example;
    method method (line 8) | fn method(&self, _cx: &mut FunctionContext) {}
  function main (line 11) | fn main() {}

FILE: test/ui/tests/fail/class-async-fn-borrowed-self.rs
  type Example (line 2) | struct Example;
    method method (line 6) | async fn method(&self) {}
  function main (line 9) | fn main() {}

FILE: test/ui/tests/fail/class-async-owned-context.rs
  type Example (line 3) | struct Example;
    method method (line 8) | fn method(&self, _cx: FunctionContext) {}
  function main (line 11) | fn main() {}

FILE: test/ui/tests/fail/class-borrowed-channel-sync.rs
  type Example (line 3) | struct Example;
    method method (line 7) | fn method(&self, _ch: &Channel) {}
  function main (line 10) | fn main() {}

FILE: test/ui/tests/fail/class-channel-in-sync.rs
  type Example (line 3) | struct Example;
    method method (line 7) | fn method(&self, _ch: Channel) {}
  function main (line 10) | fn main() {}

FILE: test/ui/tests/fail/class-constructor-self-receiver.rs
  type Example (line 1) | struct Example;
    method new (line 5) | fn new(&self) -> Self {
  function main (line 10) | fn main() {}

FILE: test/ui/tests/fail/class-constructor-with-self.rs
  type Example (line 1) | struct Example;
    method new (line 5) | fn new(self) -> Self {
  function main (line 10) | fn main() {}

FILE: test/ui/tests/fail/class-duplicate-property-names.rs
  type Example (line 1) | struct Example;
    constant VALUE1 (line 6) | const VALUE1: i32 = 42;
    constant VALUE2 (line 9) | const VALUE2: i32 = 43;
  function main (line 12) | fn main() {}

FILE: test/ui/tests/fail/class-immutable-context.rs
  type Example (line 3) | struct Example;
    method method (line 7) | fn method(&self, _cx: &FunctionContext) {}
  function main (line 10) | fn main() {}

FILE: test/ui/tests/fail/class-invalid-item-type.rs
  type Example (line 1) | struct Example;
    type AssocType (line 5) | type AssocType = i32;
  function main (line 8) | fn main() {}

FILE: test/ui/tests/fail/class-invalid-property-name.rs
  type Example (line 1) | struct Example;
    constant VALUE (line 6) | const VALUE: i32 = 42;
  function main (line 9) | fn main() {}

FILE: test/ui/tests/fail/class-method-missing-self.rs
  type Example (line 1) | struct Example;
    method method (line 5) | fn method() {}
  function main (line 8) | fn main() {}

FILE: test/ui/tests/fail/class-missing-forced-context.rs
  type Example (line 1) | struct Example;
    method method (line 6) | fn method(&self) {}
  function main (line 9) | fn main() {}

FILE: test/ui/tests/fail/class-multiple-constructors.rs
  type Example (line 1) | struct Example;
    method new (line 5) | fn new() -> Self {
    method new (line 9) | fn new() -> Self {
  function main (line 14) | fn main() {}

FILE: test/ui/tests/fail/class-multiple-finalizers.rs
  type Example (line 1) | struct Example;
    method finalize (line 5) | fn finalize<'a, C: neon::context::Context<'a>>(self, _cx: &mut C) {}
    method finalize (line 6) | fn finalize<'a, C: neon::context::Context<'a>>(self, _cx: &mut C) {}
  function main (line 9) | fn main() {}

FILE: test/ui/tests/fail/class-multiple-neon-attrs-const.rs
  type Example (line 1) | struct Example;
    constant VALUE (line 7) | const VALUE: i32 = 42;
  function main (line 10) | fn main() {}

FILE: test/ui/tests/fail/class-multiple-neon-attrs-method.rs
  type Example (line 1) | struct Example;
    method method (line 7) | fn method(&self) {}
  function main (line 10) | fn main() {}

FILE: test/ui/tests/fail/class-owned-context.rs
  type Example (line 3) | struct Example;
    method method (line 7) | fn method(&self, _cx: FunctionContext) {}
  function main (line 10) | fn main() {}

FILE: test/ui/tests/fail/missing-class-clone.rs
  type Point (line 1) | struct Point {
    method new (line 8) | fn new(x: i32, y: i32) -> Self {
    method equals (line 12) | fn equals(&self, other: Point) -> bool {
  function main (line 17) | fn main() {}

FILE: test/ui/tests/fail/missing-class-default.rs
  type Point (line 1) | struct Point {
  function main (line 10) | fn main() {}

FILE: test/ui/tests/fail/missing-context.rs
  function missing_context (line 2) | fn missing_context() {}
  function main (line 4) | fn main() {}

FILE: test/ui/tests/fail/need-borrowed-context.rs
  function owned_cx (line 2) | fn owned_cx(_cx: Cx) {}
  function owned_function_cx (line 5) | fn owned_function_cx(_cx: FunctionContext) {}
  function ref_cx (line 8) | fn ref_cx(_cx: &Cx) {}
  function ref_function_cx (line 11) | fn ref_function_cx(_cx: &FunctionContext) {}
  function forced_cx (line 14) | fn forced_cx(_cx: String) {}
  function forced_ref_cx (line 17) | fn forced_ref_cx(_cx: &String) {}
  function main (line 19) | fn main() {}

FILE: test/ui/tests/fail/unexpected-self.rs
  type Example (line 1) | struct Example;
    method borrow (line 5) | fn borrow(&self) {}
    method borrow_mut (line 8) | fn borrow_mut(&mut self) {}
    method owned (line 11) | fn owned(self) {}
  function main (line 14) | fn main() {}

FILE: test/ui/tests/fail/unnecessary-attribute.rs
  function async_with_async (line 2) | async fn async_with_async() {}
  function main (line 4) | fn main() {}

FILE: test/ui/tests/fail/unsupported-property.rs
  function unsupported (line 5) | fn unsupported() {}
  function main (line 7) | fn main() {}

FILE: test/ui/tests/fail/wrong-context.rs
  function sync_channel (line 2) | fn sync_channel(_ch: Channel) {}
  function sync_borrow_channel (line 5) | fn sync_borrow_channel(_ch: &mut Channel) {}
  function async_channel (line 8) | fn async_channel(_ch: Channel) {}
  function async_borrow_channel (line 11) | fn async_borrow_channel(_ch: &mut Channel) {}
  function async_cx (line 14) | async fn async_cx(_cx: Cx) {}
  function async_function_context (line 17) | async fn async_function_context(_cx: FunctionContext) {}
  function async_cx_ref (line 20) | async fn async_cx_ref(_cx: &Cx) {}
  function async_borrow_channel (line 23) | async fn async_borrow_channel(_cx: &Channel) {}
  function async_borrow_forced_channel (line 26) | async fn async_borrow_forced_channel(_cx: &String) {}
  function async_function_context_ref (line 29) | async fn async_function_context_ref(_cx: &FunctionContext) {}
  function task_function_context (line 32) | fn task_function_context(_cx: FunctionContext) {}
  function task_cx_ref (line 35) | fn task_cx_ref(_cx: &Cx) {}
  function task_function_context_ref (line 38) | fn task_function_context_ref(_cx: &FunctionContext) {}
  function main (line 40) | fn main() {}

FILE: test/ui/tests/pass/context-and-this.rs
  type Ch (line 10) | type Ch = Channel;
  type FnCx (line 11) | type FnCx<'cx> = FunctionContext<'cx>;
  function sync_nothing (line 14) | fn sync_nothing() {}
  function sync_function_context (line 17) | fn sync_function_context(_cx: &mut FunctionContext) {}
  function sync_cx (line 20) | fn sync_cx(_cx: &mut Cx) {}
  function sync_cx_forced (line 23) | fn sync_cx_forced(_cx: &mut FnCx) {}
  function sync_cx_lifetimes (line 26) | fn sync_cx_lifetimes<'cx>(cx: &mut Cx<'cx>) -> Handle<'cx, JsString> {
  function sync_this (line 31) | fn sync_this(this: Vec<u8>) {
  function sync_this_forced (line 36) | fn sync_this_forced(_this: Vec<u8>) {}
  function sync_cx_and_this (line 39) | fn sync_cx_and_this(_cx: &mut Cx, this: Vec<u8>) {
  function sync_cx_and_this_and_args (line 44) | fn sync_cx_and_this_and_args(_cx: &mut Cx, this: Vec<u8>, _a: String) {
  function boxed_this (line 49) | fn boxed_this(Boxed(this): Boxed<String>) {
  function async_nothing (line 54) | async fn async_nothing() {}
  function async_channel (line 57) | async fn async_channel(_ch: Channel) {}
  function async_channel_forced (line 60) | async fn async_channel_forced(_ch: Ch) {}
  function async_channel_and_arg (line 63) | async fn async_channel_and_arg(_ch: Channel, _a: String) {}
  function async_no_channel (line 66) | async fn async_no_channel(_a: String) {}
  function async_this (line 69) | async fn async_this(this: Vec<u8>) {
  function async_this_forced (line 74) | async fn async_this_forced(_this: Vec<u8>) {}
  function async_this_args (line 77) | async fn async_this_args(this: Vec<u8>, _a: String) {
  function async_this_and_channel (line 82) | async fn async_this_and_channel(_ch: Channel, this: Vec<u8>) {
  function async_this_and_channel_args (line 87) | async fn async_this_and_channel_args(_ch: Channel, this: Vec<u8>, _a: St...
  function task_nothing (line 92) | fn task_nothing() {}
  function task_channel (line 95) | fn task_channel(_ch: Channel) {}
  function task_channel_forced (line 98) | fn task_channel_forced(_ch: Ch) {}
  function task_channel_and_arg (line 101) | fn task_channel_and_arg(_ch: Channel, _a: String) {}
  function task_no_channel (line 104) | fn task_no_channel(_a: String) {}
  function task_this (line 107) | fn task_this(this: Vec<u8>) {
  function task_this_forced (line 112) | fn task_this_forced(_this: Vec<u8>) {}
  function task_this_args (line 115) | fn task_this_args(this: Vec<u8>, _a: String) {
  function task_this_and_channel (line 120) | fn task_this_and_channel(_ch: Channel, this: Vec<u8>) {
  function task_this_and_channel_args (line 125) | fn task_this_and_channel_args(_ch: Channel, this: Vec<u8>, _a: String, _...
  function impl_async_context (line 130) | fn impl_async_context(_cx: &mut Cx) -> impl Future<Output = ()> {
  function main (line 134) | fn main() {}

FILE: test/ui/tests/pass/globals.rs
  constant CONST_NUMBER (line 5) | const CONST_NUMBER: f64 = 42.0;
  function main (line 13) | fn main() {}

FILE: test/ui/tests/pass/json.rs
  function wrap_with_json (line 2) | fn wrap_with_json(v: Vec<String>) -> Vec<String> {
  function main (line 6) | fn main() {}
Condensed preview — 280 files, each showing path, character count, and a content snippet. Download the .json file or copy for the full structured content (1,083K chars).
[
  {
    "path": ".cargo/config.toml",
    "chars": 672,
    "preview": "[alias]\n# Neon defines mutually exclusive feature flags which prevents using `cargo clippy --all-features`\n# The followi"
  },
  {
    "path": ".editorconfig",
    "chars": 238,
    "preview": "root = true\n\n[*]\nindent_style = space\nindent_size = 2\nend_of_line = lf\ncharset = utf-8\ntrim_trailing_whitespace = true\ni"
  },
  {
    "path": ".github/workflows/bench.yml",
    "chars": 1812,
    "preview": "name: Benchmarks\n\non:\n  push:\n    branches:\n      - main\n  pull_request:\n    branches:\n      - main\n\njobs:\n  bench:\n    "
  },
  {
    "path": ".github/workflows/ci.yml",
    "chars": 4189,
    "preview": "name: CI\n\non:\n  push:\n    # Prevent duplicate runs of this workflow on our own internal PRs.\n    branches:\n      - main\n"
  },
  {
    "path": ".github/workflows/lint.yml",
    "chars": 1355,
    "preview": "name: Lints\n\non:\n  push:\n    # Prevent duplicate runs of this workflow on our own internal PRs.\n    branches:\n      - ma"
  },
  {
    "path": ".gitignore",
    "chars": 315,
    "preview": "# Rust\ntarget\nrls*.log\n\n# Created by `trybuild` ui tests\nwip\n**/*~\n\n# Node\n**/node_modules\nnpm-debug.log\n\n# JS build\n**/"
  },
  {
    "path": ".prettierignore",
    "chars": 75,
    "preview": ".git/\ncli/lib/\ntest/cli/lib/\nnode_modules/\n**/dist/\ntarget/\nartifacts.json\n"
  },
  {
    "path": "AUTHORS.md",
    "chars": 3581,
    "preview": "# Authors\n\nNeon owes its existence to the contributions of these fine people.\n\n* [Reza Akhavan](https://github.com/jedir"
  },
  {
    "path": "CODE_OF_CONDUCT.md",
    "chars": 3197,
    "preview": "# Contributor Covenant Code of Conduct\n\n## Our Pledge\n\nIn the interest of fostering an open and welcoming environment, w"
  },
  {
    "path": "CONTRIBUTING.md",
    "chars": 2281,
    "preview": "# Contributing to Neon\n\nNeon welcomes contribution from everyone. Here are some resources to help you join us!\n\n## Contr"
  },
  {
    "path": "Cargo.toml",
    "chars": 114,
    "preview": "[workspace]\nresolver = \"2\"\nmembers = [\n    \"crates/*\",\n    \"test/*\",\n    \"bench\",\n]\n\n[profile.release]\nlto = true\n"
  },
  {
    "path": "LICENSE-APACHE",
    "chars": 10847,
    "preview": "                              Apache License\n                        Version 2.0, January 2004\n                     http"
  },
  {
    "path": "LICENSE-MIT",
    "chars": 1056,
    "preview": "Copyright (c) 2015 David Herman\n\nPermission is hereby granted, free of charge, to any person obtaining a copy\nof this so"
  },
  {
    "path": "README.md",
    "chars": 4107,
    "preview": "# <img src=\"https://raw.githubusercontent.com/neon-bindings/neon/refs/heads/main/doc/neon.png\" alt=\"neon\" width=\"100%\" /"
  },
  {
    "path": "RELEASES.md",
    "chars": 31316,
    "preview": "# `cargo-cp-artifact`\n\n`0.1.9` supports a [breaking change in `cargo`](https://github.com/rust-lang/cargo/issues/13867) "
  },
  {
    "path": "bench/.gitignore",
    "chars": 46,
    "preview": "index.node\nnpm-debug.log*\ncargo.log\ncross.log\n"
  },
  {
    "path": "bench/Cargo.toml",
    "chars": 383,
    "preview": "[package]\nname = \"bench\"\nversion = \"0.1.0\"\ndescription = \"Neon performance regression suite\"\nauthors = [\"David Herman <d"
  },
  {
    "path": "bench/README.md",
    "chars": 200,
    "preview": "# bench: Neon performance regression suite\n\n## Building bench\n\nTo run the build, run:\n\n```sh\n$ npm run build\n```\n\n## Run"
  },
  {
    "path": "bench/index.js",
    "chars": 1754,
    "preview": "const { Suite, jsonReport } = require(\"bench-node\");\nconst addon = require(\"./index.node\");\n\nfunction median(values) {\n "
  },
  {
    "path": "bench/package.json",
    "chars": 777,
    "preview": "{\n  \"name\": \"bench\",\n  \"private\": true,\n  \"description\": \"Neon performance regression suite\",\n  \"main\": \"index.js\",\n  \"s"
  },
  {
    "path": "bench/src/lib.rs",
    "chars": 1633,
    "preview": "use neon::prelude::*;\n\n#[neon::export]\nfn export_noop() {}\n\nfn manual_noop(mut cx: FunctionContext) -> JsResult<JsUndefi"
  },
  {
    "path": "codecov.yml",
    "chars": 83,
    "preview": "ignore:\n  - \"bench\"\n  - \"test\"\ncoverage:\n  status:\n    project: off\n    patch: off\n"
  },
  {
    "path": "crates/neon/Cargo.toml",
    "chars": 3098,
    "preview": "[package]\nname = \"neon\"\nversion = \"1.1.1\"\nauthors = [\"Dave Herman <david.herman@gmail.com>\"]\ndescription = \"A safe abstr"
  },
  {
    "path": "crates/neon/src/context/internal.rs",
    "chars": 2222,
    "preview": "use std::{cell::RefCell, ffi::c_void, mem::MaybeUninit};\n\nuse crate::{\n    context::{Cx, ModuleContext},\n    handle::Han"
  },
  {
    "path": "crates/neon/src/context/mod.rs",
    "chars": 30685,
    "preview": "//! Provides runtime access to the JavaScript engine.\n//!\n//! An _execution context_ represents the current state of a t"
  },
  {
    "path": "crates/neon/src/event/channel.rs",
    "chars": 12639,
    "preview": "use std::{\n    error, fmt,\n    sync::{\n        atomic::{AtomicUsize, Ordering},\n        Arc,\n    },\n};\n\nuse crate::{\n   "
  },
  {
    "path": "crates/neon/src/event/mod.rs",
    "chars": 5407,
    "preview": "//! Exposes the JavaScript event loop for scheduling asynchronous events.\n//!\n//! ## The Event Loop\n//!\n//! The [_event "
  },
  {
    "path": "crates/neon/src/event/task.rs",
    "chars": 4134,
    "preview": "use std::{panic::resume_unwind, thread};\n\nuse crate::{\n    context::{internal::Env, Context, Cx},\n    handle::Handle,\n  "
  },
  {
    "path": "crates/neon/src/executor/mod.rs",
    "chars": 1710,
    "preview": "use std::{future::Future, pin::Pin};\n\nuse crate::{context::Cx, thread::LocalKey};\n\n#[cfg(feature = \"tokio-rt\")]\npub(crat"
  },
  {
    "path": "crates/neon/src/executor/tokio.rs",
    "chars": 1666,
    "preview": "use std::sync::Arc;\n\nuse super::{BoxFuture, Runtime};\n\nimpl Runtime for tokio::runtime::Runtime {\n    fn spawn(&self, fu"
  },
  {
    "path": "crates/neon/src/handle/internal.rs",
    "chars": 835,
    "preview": "use std::{fmt::Debug, mem};\n\nuse crate::types::Value;\n\npub trait SuperType<T: Value> {\n    fn upcast_internal(v: &T) -> "
  },
  {
    "path": "crates/neon/src/handle/mod.rs",
    "chars": 6578,
    "preview": "//! References to garbage-collected JavaScript values.\n//!\n//! A _handle_ is a safe reference to a JavaScript value that"
  },
  {
    "path": "crates/neon/src/handle/root.rs",
    "chars": 8038,
    "preview": "use std::{ffi::c_void, marker::PhantomData};\n\nuse crate::{\n    context::Context,\n    handle::Handle,\n    object::Object,"
  },
  {
    "path": "crates/neon/src/lib.rs",
    "chars": 7805,
    "preview": "//! The [Neon][neon] crate provides bindings for writing [Node.js addons][addons]\n//! (i.e., dynamically-loaded binary m"
  },
  {
    "path": "crates/neon/src/lifecycle.rs",
    "chars": 9204,
    "preview": "//! # Environment life cycle APIs\n//!\n//! These APIs map to the life cycle of a specific \"Agent\" or self-contained\n//! e"
  },
  {
    "path": "crates/neon/src/macro_internal/futures.rs",
    "chars": 759,
    "preview": "use std::future::Future;\n\nuse crate::{\n    context::{Context, Cx, TaskContext},\n    result::JsResult,\n    types::JsValue"
  },
  {
    "path": "crates/neon/src/macro_internal/mod.rs",
    "chars": 3676,
    "preview": "//! Internals needed by macros. These have to be exported for the macros to work\n\nuse std::marker::PhantomData;\n\npub use"
  },
  {
    "path": "crates/neon/src/macros.rs",
    "chars": 28862,
    "preview": "//! Helper module to add documentation to macros prior to re-exporting.\n\n#[cfg(feature = \"napi-6\")]\n/// Create a Neon cl"
  },
  {
    "path": "crates/neon/src/meta.rs",
    "chars": 720,
    "preview": "//! Metadata about the Neon version and build.\n\nuse semver::Version;\n\n/// The Neon version.\npub const VERSION: &str = en"
  },
  {
    "path": "crates/neon/src/object/class.rs",
    "chars": 2249,
    "preview": "use crate::{\n    context::Cx,\n    handle::{Handle, Root},\n    object::Object,\n    result::{JsResult, NeonResult},\n    ty"
  },
  {
    "path": "crates/neon/src/object/mod.rs",
    "chars": 12018,
    "preview": "//! Traits for working with JavaScript objects.\n//!\n//! This module defines the [`Object`] trait, which is implemented\n/"
  },
  {
    "path": "crates/neon/src/object/wrap.rs",
    "chars": 6878,
    "preview": "use std::{any::Any, error, ffi::c_void, fmt, mem::MaybeUninit, ptr};\n\nuse crate::{\n    context::{\n        internal::{Con"
  },
  {
    "path": "crates/neon/src/prelude.rs",
    "chars": 971,
    "preview": "//! Convenience module for the most common Neon imports.\n\n#[doc(no_inline)]\npub use crate::{\n    context::{CallKind, Con"
  },
  {
    "path": "crates/neon/src/reflect.rs",
    "chars": 455,
    "preview": "//! Exposes JavaScript's reflection API to Rust.\n\nuse crate::{\n    context::Context,\n    handle::Handle,\n    result::JsR"
  },
  {
    "path": "crates/neon/src/result/mod.rs",
    "chars": 3742,
    "preview": "//! Represents JavaScript exceptions as a Rust [`Result`](std::result) type.\n//!\n//! Most interactions with the JavaScri"
  },
  {
    "path": "crates/neon/src/sys/array.rs",
    "chars": 604,
    "preview": "//! Facilities for working with Array `napi_value`s.\n\nuse super::{\n    bindings as napi,\n    raw::{Env, Local},\n};\n\npub "
  },
  {
    "path": "crates/neon/src/sys/arraybuffer.rs",
    "chars": 2099,
    "preview": "#[cfg(feature = \"external-buffers\")]\nuse std::os::raw::c_void;\nuse std::{mem::MaybeUninit, ptr::null_mut, slice};\n\nuse s"
  },
  {
    "path": "crates/neon/src/sys/async_work.rs",
    "chars": 5649,
    "preview": "//! Rust wrappers for Node-API simple asynchronous operations\n//!\n//! Unlike `napi_async_work` which threads a single mu"
  },
  {
    "path": "crates/neon/src/sys/bindings/functions.rs",
    "chars": 16165,
    "preview": "#![allow(clippy::too_many_arguments)]\n\nmod napi1 {\n    use super::super::types::*;\n    use std::os::raw::{c_char, c_void"
  },
  {
    "path": "crates/neon/src/sys/bindings/mod.rs",
    "chars": 6077,
    "preview": "//! # FFI bindings to Node-API symbols\n//!\n//! Rust types generated from [Node-API](https://nodejs.org/api/n-api.html).\n"
  },
  {
    "path": "crates/neon/src/sys/bindings/types.rs",
    "chars": 8355,
    "preview": "use std::ffi::c_void;\n\n#[repr(C)]\n#[derive(Debug, Copy, Clone)]\n#[doc(hidden)]\npub struct Env__ {\n    _unused: [u8; 0],\n"
  },
  {
    "path": "crates/neon/src/sys/buffer.rs",
    "chars": 2347,
    "preview": "#[cfg(feature = \"external-buffers\")]\nuse std::os::raw::c_void;\nuse std::{mem::MaybeUninit, slice};\n\nuse super::{\n    bin"
  },
  {
    "path": "crates/neon/src/sys/call.rs",
    "chars": 3384,
    "preview": "use std::{mem::MaybeUninit, ptr::null_mut};\n\nuse smallvec::SmallVec;\n\nuse super::{\n    bindings as napi,\n    raw::{Env, "
  },
  {
    "path": "crates/neon/src/sys/convert.rs",
    "chars": 227,
    "preview": "use super::{\n    bindings as napi,\n    raw::{Env, Local},\n};\n\npub unsafe fn to_string(out: &mut Local, env: Env, value: "
  },
  {
    "path": "crates/neon/src/sys/date.rs",
    "chars": 813,
    "preview": "use std::mem::MaybeUninit;\n\nuse super::{\n    bindings as napi,\n    raw::{Env, Local},\n};\n\n/// Create a new date object\n/"
  },
  {
    "path": "crates/neon/src/sys/debug_send_wrapper.rs",
    "chars": 1158,
    "preview": "//! Wrapper that ensures types are always used from the same thread\n//! in debug builds. It is a zero-cost in release bu"
  },
  {
    "path": "crates/neon/src/sys/error.rs",
    "chars": 2334,
    "preview": "use std::{mem::MaybeUninit, panic::Location, ptr};\n\nuse super::{\n    bindings as napi,\n    raw::{Env, Local},\n};\n\npub un"
  },
  {
    "path": "crates/neon/src/sys/external.rs",
    "chars": 2967,
    "preview": "use std::mem::MaybeUninit;\n\nuse super::{\n    bindings as napi,\n    debug_send_wrapper::DebugSendWrapper,\n    raw::{Env, "
  },
  {
    "path": "crates/neon/src/sys/fun.rs",
    "chars": 2316,
    "preview": "//! Facilities for working with JS functions.\n\nuse std::{mem::MaybeUninit, os::raw::c_void, ptr};\n\nuse super::{\n    bind"
  },
  {
    "path": "crates/neon/src/sys/lifecycle.rs",
    "chars": 1412,
    "preview": "//! # Environment life cycle APIs\n//!\n//! These APIs map to the life cycle of a specific \"Agent\" or self-contained\n//! e"
  },
  {
    "path": "crates/neon/src/sys/mem.rs",
    "chars": 247,
    "preview": "use super::{\n    bindings as napi,\n    raw::{Env, Local},\n};\n\npub unsafe fn strict_equals(env: Env, lhs: Local, rhs: Loc"
  },
  {
    "path": "crates/neon/src/sys/mod.rs",
    "chars": 3972,
    "preview": "//! Raw bindings to [Node-API][node-api]\n//!\n//! [Node-API][node-api] is Node.js's API for building native addons. Neon "
  },
  {
    "path": "crates/neon/src/sys/no_panic.rs",
    "chars": 9274,
    "preview": "//! Utilities that _will_ not panic for use in contexts where unwinding would be\n//! undefined behavior.\n//!\n//! The fol"
  },
  {
    "path": "crates/neon/src/sys/object.rs",
    "chars": 5095,
    "preview": "use std::mem::MaybeUninit;\n\nuse super::{\n    bindings as napi,\n    raw::{Env, Local},\n};\n\n/// Mutates the `out` argument"
  },
  {
    "path": "crates/neon/src/sys/primitive.rs",
    "chars": 1514,
    "preview": "use super::{\n    bindings as napi,\n    raw::{Env, Local},\n};\n\n/// Mutates the `out` argument provided to refer to the gl"
  },
  {
    "path": "crates/neon/src/sys/promise.rs",
    "chars": 1822,
    "preview": "//! JavaScript Promise and Deferred handle\n//!\n//! See: [Promises in Node-API](https://nodejs.org/api/n-api.html#n_api_p"
  },
  {
    "path": "crates/neon/src/sys/raw.rs",
    "chars": 140,
    "preview": "use super::bindings as napi;\n\npub type Local = napi::Value;\n\npub type FunctionCallbackInfo = napi::CallbackInfo;\n\npub ty"
  },
  {
    "path": "crates/neon/src/sys/reference.rs",
    "chars": 1251,
    "preview": "use std::mem::MaybeUninit;\n\nuse super::{\n    bindings as napi,\n    raw::{Env, Local},\n};\n\npub unsafe fn new(env: Env, va"
  },
  {
    "path": "crates/neon/src/sys/scope.rs",
    "chars": 1639,
    "preview": "use std::mem::MaybeUninit;\n\nuse super::{\n    bindings as napi,\n    raw::{Env, Local},\n};\n\npub(crate) struct HandleScope "
  },
  {
    "path": "crates/neon/src/sys/string.rs",
    "chars": 1369,
    "preview": "use std::{mem::MaybeUninit, ptr};\n\nuse super::{\n    bindings as napi,\n    raw::{Env, Local},\n};\n\npub unsafe fn new(out: "
  },
  {
    "path": "crates/neon/src/sys/tag.rs",
    "chars": 3142,
    "preview": "use super::{\n    bindings as napi,\n    raw::{Env, Local},\n};\n\n/// Return true if an `napi_value` `val` has the expected "
  },
  {
    "path": "crates/neon/src/sys/tsfn.rs",
    "chars": 6158,
    "preview": "//! Idiomatic Rust wrappers for N-API threadsafe functions\n\nuse std::{\n    ffi::c_void,\n    mem::MaybeUninit,\n    ptr,\n "
  },
  {
    "path": "crates/neon/src/sys/typedarray.rs",
    "chars": 1559,
    "preview": "use std::{ffi::c_void, mem::MaybeUninit};\n\nuse super::{\n    bindings::{self as napi, TypedArrayType},\n    raw::{Env, Loc"
  },
  {
    "path": "crates/neon/src/thread/mod.rs",
    "chars": 9094,
    "preview": "//! Thread-local storage for JavaScript threads.\n//!\n//! At runtime, an instance of a Node.js addon can contain its own "
  },
  {
    "path": "crates/neon/src/types_docs.rs",
    "chars": 5813,
    "preview": "#[cfg_attr(feature = \"aquamarine\", aquamarine::aquamarine)]\n/// Representations of JavaScript's core builtin types.\n///\n"
  },
  {
    "path": "crates/neon/src/types_impl/bigint.rs",
    "chars": 12048,
    "preview": "//! Types for working with [`JsBigInt`].\n\nuse std::{error, fmt, mem::MaybeUninit};\n\nuse crate::{\n    context::{\n        "
  },
  {
    "path": "crates/neon/src/types_impl/boxed.rs",
    "chars": 14461,
    "preview": "use std::{\n    any::{self, Any},\n    ops::Deref,\n};\n\nuse crate::{\n    context::{\n        internal::{ContextInternal, Env"
  },
  {
    "path": "crates/neon/src/types_impl/buffer/lock.rs",
    "chars": 5677,
    "preview": "use std::{cell::RefCell, ops::Range};\n\nuse crate::{\n    context::Context,\n    types::buffer::{BorrowError, Ref, RefMut},"
  },
  {
    "path": "crates/neon/src/types_impl/buffer/mod.rs",
    "chars": 9006,
    "preview": "//! Types and traits for working with binary buffers.\n\nuse std::{\n    cell::RefCell,\n    error::Error,\n    fmt::{self, D"
  },
  {
    "path": "crates/neon/src/types_impl/buffer/types.rs",
    "chars": 30181,
    "preview": "use std::{marker::PhantomData, slice};\n\nuse crate::{\n    context::{\n        internal::{ContextInternal, Env},\n        Co"
  },
  {
    "path": "crates/neon/src/types_impl/date.rs",
    "chars": 5603,
    "preview": "use std::{\n    error::Error,\n    fmt::{self, Debug},\n};\n\nuse super::{private::ValueInternal, Value};\n\nuse crate::{\n    c"
  },
  {
    "path": "crates/neon/src/types_impl/error.rs",
    "chars": 4138,
    "preview": "//! Types and traits representing JavaScript error values.\n\nuse std::panic::{catch_unwind, UnwindSafe};\n\nuse crate::{\n  "
  },
  {
    "path": "crates/neon/src/types_impl/extract/array.rs",
    "chars": 5390,
    "preview": "use std::{error, fmt, mem::MaybeUninit};\n\nuse crate::{\n    context::{internal::ContextInternal, Context, Cx},\n    handle"
  },
  {
    "path": "crates/neon/src/types_impl/extract/boxed.rs",
    "chars": 1783,
    "preview": "use crate::{\n    context::{Context, Cx},\n    handle::Handle,\n    result::{JsResult, NeonResult},\n    types::{\n        ex"
  },
  {
    "path": "crates/neon/src/types_impl/extract/buffer.rs",
    "chars": 5451,
    "preview": "use crate::{\n    context::Cx,\n    handle::Handle,\n    result::{JsResult, NeonResult},\n    types::{\n        buffer::{Bina"
  },
  {
    "path": "crates/neon/src/types_impl/extract/container.rs",
    "chars": 3627,
    "preview": "use std::{\n    cell::{Ref, RefCell, RefMut},\n    rc::Rc,\n    sync::{Arc, LazyLock},\n};\n\nuse crate::{\n    context::{Conte"
  },
  {
    "path": "crates/neon/src/types_impl/extract/either.rs",
    "chars": 2591,
    "preview": "use std::{any, error, fmt};\n\nuse either::Either;\n\nuse crate::{\n    context::Cx,\n    handle::Handle,\n    object::Object,\n"
  },
  {
    "path": "crates/neon/src/types_impl/extract/error.rs",
    "chars": 4245,
    "preview": "use std::{convert::Infallible, error, fmt, marker::PhantomData};\n\nuse crate::{\n    context::{Context, Cx},\n    result::J"
  },
  {
    "path": "crates/neon/src/types_impl/extract/json.rs",
    "chars": 4374,
    "preview": "//! Extract JavaScript values with JSON serialization\n//!\n//! For complex objects that implement [`serde::Serialize`] an"
  },
  {
    "path": "crates/neon/src/types_impl/extract/mod.rs",
    "chars": 10804,
    "preview": "//! Traits and utilities for extract Rust data from JavaScript values.\n//!\n//! The full list of included extractors can "
  },
  {
    "path": "crates/neon/src/types_impl/extract/private.rs",
    "chars": 1308,
    "preview": "use std::{\n    cell::{Ref, RefCell, RefMut},\n    rc::Rc,\n    sync::Arc,\n};\n\nuse crate::{\n    context::FunctionContext,\n "
  },
  {
    "path": "crates/neon/src/types_impl/extract/try_from_js.rs",
    "chars": 7383,
    "preview": "// Implementations in this file are equivalent to a call to `.downcast()` and\n// `.value(&mut cx)`. These specialized ve"
  },
  {
    "path": "crates/neon/src/types_impl/extract/try_into_js.rs",
    "chars": 3355,
    "preview": "use crate::{\n    context::{Context, Cx},\n    handle::{Handle, Root},\n    object::Object,\n    result::{JsResult, Throw},\n"
  },
  {
    "path": "crates/neon/src/types_impl/extract/with.rs",
    "chars": 1644,
    "preview": "use crate::{\n    context::Cx,\n    result::JsResult,\n    types::{extract::TryIntoJs, Value},\n};\n\nstruct With<F>(pub F);\n\n"
  },
  {
    "path": "crates/neon/src/types_impl/function/mod.rs",
    "chars": 12063,
    "preview": "//! Types and traits for working with JavaScript functions.\n\nuse smallvec::smallvec;\n\nuse crate::{\n    context::{Context"
  },
  {
    "path": "crates/neon/src/types_impl/function/private.rs",
    "chars": 479,
    "preview": "use smallvec::SmallVec;\n\nuse crate::{context::Cx, handle::Handle, result::NeonResult, types::JsValue};\n\npub type ArgsVec"
  },
  {
    "path": "crates/neon/src/types_impl/mod.rs",
    "chars": 38706,
    "preview": "// See types_docs.rs for top-level module API docs.\n\n#[cfg(feature = \"napi-6\")]\n#[cfg_attr(docsrs, doc(cfg(feature = \"na"
  },
  {
    "path": "crates/neon/src/types_impl/private.rs",
    "chars": 3751,
    "preview": "use std::{ffi::c_void, mem::MaybeUninit};\n\nuse crate::{\n    context::{\n        internal::{ContextInternal, Env},\n       "
  },
  {
    "path": "crates/neon/src/types_impl/promise.rs",
    "chars": 20248,
    "preview": "use std::ptr;\n\nuse crate::{\n    context::{\n        internal::{ContextInternal, Env},\n        Context, Cx,\n    },\n    han"
  },
  {
    "path": "crates/neon/src/types_impl/utf8.rs",
    "chars": 1573,
    "preview": "use std::borrow::Cow;\n\nconst SMALL_MAX: usize = i32::MAX as usize;\n\n/// V8 APIs that take UTF-8 strings take their lengt"
  },
  {
    "path": "crates/neon-macros/Cargo.toml",
    "chars": 378,
    "preview": "[package]\nname = \"neon-macros\"\nversion = \"1.1.1\"\nauthors = [\"Dave Herman <david.herman@gmail.com>\"]\ndescription = \"Proce"
  },
  {
    "path": "crates/neon-macros/LICENSE-APACHE",
    "chars": 10847,
    "preview": "                              Apache License\n                        Version 2.0, January 2004\n                     http"
  },
  {
    "path": "crates/neon-macros/LICENSE-MIT",
    "chars": 1056,
    "preview": "Copyright (c) 2015 David Herman\n\nPermission is hereby granted, free of charge, to any person obtaining a copy\nof this so"
  },
  {
    "path": "crates/neon-macros/src/class/meta.rs",
    "chars": 3129,
    "preview": "#[derive(Default)]\npub(crate) struct Meta {\n    pub(super) kind: Kind,\n    pub(super) name: Option<syn::LitStr>,\n    pub"
  },
  {
    "path": "crates/neon-macros/src/class/mod.rs",
    "chars": 51042,
    "preview": "mod meta;\n\nuse super::name::is_valid_js_identifier;\nuse proc_macro2::TokenStream;\nuse syn::{spanned::Spanned, Ident, Imp"
  },
  {
    "path": "crates/neon-macros/src/export/class/meta.rs",
    "chars": 3124,
    "preview": "use syn::parse::{Parse, ParseStream};\n\n/// Metadata for class exports\n#[derive(Default)]\npub(crate) struct Meta {\n    //"
  },
  {
    "path": "crates/neon-macros/src/export/class.rs",
    "chars": 3511,
    "preview": "use proc_macro2::TokenStream;\nuse quote::quote;\nuse syn::spanned::Spanned;\n\npub(crate) mod meta;\n\npub(super) fn export(m"
  },
  {
    "path": "crates/neon-macros/src/export/function/meta.rs",
    "chars": 2603,
    "preview": "#[derive(Default)]\npub(crate) struct Meta {\n    pub(super) kind: Kind,\n    pub(super) name: Option<syn::LitStr>,\n    pub"
  },
  {
    "path": "crates/neon-macros/src/export/function/mod.rs",
    "chars": 12489,
    "preview": "use syn::spanned::Spanned;\n\nuse crate::export::function::meta::Kind;\n\npub(crate) mod meta;\n\npub(super) fn export(meta: m"
  },
  {
    "path": "crates/neon-macros/src/export/global/meta.rs",
    "chars": 790,
    "preview": "#[derive(Default)]\npub(crate) struct Meta {\n    pub(super) name: Option<syn::LitStr>,\n    pub(super) json: bool,\n}\n\npub("
  },
  {
    "path": "crates/neon-macros/src/export/global/mod.rs",
    "chars": 2361,
    "preview": "pub(crate) mod meta;\n\n// Create a new block expression for the RHS of an assignment\npub(super) fn export(meta: meta::Met"
  },
  {
    "path": "crates/neon-macros/src/export/mod.rs",
    "chars": 1893,
    "preview": "mod class;\nmod function;\nmod global;\n\n// N.B.: Meta attribute parsing happens in this function because `syn::parse_macro"
  },
  {
    "path": "crates/neon-macros/src/lib.rs",
    "chars": 1275,
    "preview": "//! Procedural macros supporting [Neon](https://docs.rs/neon/latest/neon/)\n\nmod class;\nmod export;\npub(crate) mod name;\n"
  },
  {
    "path": "crates/neon-macros/src/name.rs",
    "chars": 4439,
    "preview": "// Convert identifiers to camel case with the following rules:\n// * All leading and trailing underscores are preserved\n/"
  },
  {
    "path": "doc/MIGRATION_GUIDE_0.10.md",
    "chars": 9298,
    "preview": "# Neon 0.10 Migration Guide\n\nWith the API improvements of Neon 0.10, a few backwards-incompatible changes have been intr"
  },
  {
    "path": "doc/MIGRATION_GUIDE_1.0.0.md",
    "chars": 3388,
    "preview": "# Neon 1.0.0 Migration Guide\n\n> **Note:** This migration guide assumes a project is using Neon 0.10 without Node-API bac"
  },
  {
    "path": "doc/MIGRATION_GUIDE_NAPI.md",
    "chars": 11255,
    "preview": "# N-API Migration Guide\n\n## What is this about?\n\nSince v10, Node.js supports an improved API for building native modules"
  },
  {
    "path": "package.json",
    "chars": 446,
    "preview": "{\n  \"name\": \"neon-workspace\",\n  \"private\": true,\n  \"scripts\": {\n    \"prettier\": \"prettier -w \\\"**/*.{js,json,ts,yml}\\\"\","
  },
  {
    "path": "pkgs/cargo-cp-artifact/LICENSE",
    "chars": 1073,
    "preview": "MIT License\n\nCopyright (c) 2021 The Neon Project\n\nPermission is hereby granted, free of charge, to any person obtaining "
  },
  {
    "path": "pkgs/cargo-cp-artifact/README.md",
    "chars": 3128,
    "preview": "# cargo-cp-artifact\n\n`cargo-cp-artifact` is a small command line utility for parsing cargo metadata output and copying a"
  },
  {
    "path": "pkgs/cargo-cp-artifact/bin/cargo-cp-artifact.js",
    "chars": 104,
    "preview": "#!/usr/bin/env node\n\"use strict\";\n\nconst run = require(\"..\");\n\nrun(process.argv.slice(2), process.env);\n"
  },
  {
    "path": "pkgs/cargo-cp-artifact/package.json",
    "chars": 744,
    "preview": "{\n  \"name\": \"cargo-cp-artifact\",\n  \"version\": \"0.1.9\",\n  \"description\": \"Copies compiler artifacts emitted by rustc by p"
  },
  {
    "path": "pkgs/cargo-cp-artifact/src/args.js",
    "chars": 2884,
    "preview": "\"use strict\";\n\nclass ParseError extends Error {}\n\nconst NPM_ENV = \"npm_package_name\";\nconst EXPECTED_COMMAND = [\n  \"Miss"
  },
  {
    "path": "pkgs/cargo-cp-artifact/src/index.js",
    "chars": 4359,
    "preview": "\"use strict\";\n\nconst { spawn } = require(\"child_process\");\nconst {\n  promises: { copyFile, mkdir, stat, unlink },\n} = re"
  },
  {
    "path": "pkgs/cargo-cp-artifact/test/args.js",
    "chars": 3243,
    "preview": "\"use strict\";\n\nconst assert = require(\"assert\");\n\nconst { parse } = require(\"../src/args\");\n\ndescribe(\"Argument Parsing\""
  },
  {
    "path": "pkgs/create-neon/.mocharc.json",
    "chars": 76,
    "preview": "{\n  \"extension\": [\"ts\"],\n  \"spec\": \"dist/test/**/*.js\",\n  \"timeout\": 5000\n}\n"
  },
  {
    "path": "pkgs/create-neon/README.md",
    "chars": 2708,
    "preview": "# Create Neon\n\nThe `create-neon` tool bootstraps [Neon](https://neon-bindings.com) projects, which allows developers to "
  },
  {
    "path": "pkgs/create-neon/data/templates/.gitignore.hbs",
    "chars": 135,
    "preview": "target\nindex.node\n**/node_modules\n**/.DS_Store\nnpm-debug.log*{{#eq options.library.lang compare=\"ts\"}}\nlib\n{{/eq}}\ncargo"
  },
  {
    "path": "pkgs/create-neon/data/templates/Cargo.toml.hbs",
    "chars": 500,
    "preview": "[package]\nname = {{crate.escaped.name}}\nversion = {{crate.escaped.version}}\n{{#if crate.description}}\ndescription = {{cr"
  },
  {
    "path": "pkgs/create-neon/data/templates/README.md.hbs",
    "chars": 5820,
    "preview": "# {{package.name}}\n\n{{#if package.description}}\n**{{package.name}}:** {{package.description}}\n\n{{/if}}\nThis project was "
  },
  {
    "path": "pkgs/create-neon/data/templates/Workspace.toml.hbs",
    "chars": 63,
    "preview": "[workspace]\nmembers = [\"crates/{{crate.name}}\"]\nresolver = \"3\"\n"
  },
  {
    "path": "pkgs/create-neon/data/templates/ci/github/build.yml.hbs",
    "chars": 4684,
    "preview": "name: Build\n\non:\n  workflow_call:\n    inputs:\n      ref:\n        description: 'The branch, tag, or SHA to check out'\n   "
  },
  {
    "path": "pkgs/create-neon/data/templates/ci/github/release.yml.hbs",
    "chars": 4783,
    "preview": "name: Release\n\nrun-name: |\n  {{#$}} (inputs.dryrun && 'Dry run')\n   || format('Release: {0}', (inputs.version == 'custom"
  },
  {
    "path": "pkgs/create-neon/data/templates/ci/github/setup.yml.hbs",
    "chars": 2535,
    "preview": "name: 'Setup Neon'\ndescription: 'Setup the Neon toolchain.'\ninputs:\n  platform:\n    description: 'Platform being built f"
  },
  {
    "path": "pkgs/create-neon/data/templates/ci/github/test.yml.hbs",
    "chars": 2294,
    "preview": "name: Test\n\nrun-name: |\n  {{#$}} (github.event_name == 'pull_request' && format('Test (PR #{0}): {1}', github.event.numb"
  },
  {
    "path": "pkgs/create-neon/data/templates/lib.rs.hbs",
    "chars": 484,
    "preview": "// Use #[neon::export] to export Rust functions as JavaScript functions.\n// See more at: https://docs.rs/neon/latest/neo"
  },
  {
    "path": "pkgs/create-neon/data/templates/manifest/base/default.json.hbs",
    "chars": 416,
    "preview": "\n{\n  \"name\": \"{{options.fullName}}\",\n  \"version\": \"{{options.version}}\",\n  \"main\": \"index.node\",\n  \"scripts\": {},\n  \"dev"
  },
  {
    "path": "pkgs/create-neon/data/templates/manifest/base/library.json.hbs",
    "chars": 1195,
    "preview": "\n{\n  \"name\": \"{{options.fullName}}\",\n  \"version\": \"{{options.version}}\",\n{{#eq options.library.module compare=\"esm\"}}\n  "
  },
  {
    "path": "pkgs/create-neon/data/templates/ts/index.cts.hbs",
    "chars": 450,
    "preview": "// This module is the CJS entry point for the library.\n\n// The Rust addon.\nimport * as addon from './load.cjs';\n\n// Use "
  },
  {
    "path": "pkgs/create-neon/data/templates/ts/index.mts.hbs",
    "chars": 85,
    "preview": "// This module is the ESM entry point for the library.\n\nexport * from './index.cjs';\n"
  },
  {
    "path": "pkgs/create-neon/data/templates/ts/load.cts.hbs",
    "chars": 378,
    "preview": "// This module loads the platform-specific build of the addon on\n// the current system. The supported platforms are regi"
  },
  {
    "path": "pkgs/create-neon/data/templates/tsconfig.json.hbs",
    "chars": 363,
    "preview": "{\n{{#eq options.library.lang compare=\"ts\"}}\n  \"extends\": \"@tsconfig/node{{versions.tsconfigNode.major}}/tsconfig.json\",\n"
  },
  {
    "path": "pkgs/create-neon/data/versions.json",
    "chars": 822,
    "preview": "{\n  \"neon\": \"1.1\",\n  \"neonCLI\": \"0.1.82\",\n  \"neonLoad\": \"0.1.82\",\n  \"typescript\": \"5.3.3\",\n  \"typesNode\": \"20.11.16\",\n  "
  },
  {
    "path": "pkgs/create-neon/dev/expect.ts",
    "chars": 5185,
    "preview": "import { ChildProcess } from \"child_process\";\nimport { Readable, Writable } from \"stream\";\nimport readStream from \"strea"
  },
  {
    "path": "pkgs/create-neon/package.json",
    "chars": 1822,
    "preview": "{\n  \"name\": \"create-neon\",\n  \"version\": \"0.7.0\",\n  \"description\": \"Create Neon projects with no build configuration.\",\n "
  },
  {
    "path": "pkgs/create-neon/src/bin/create-neon.ts",
    "chars": 5024,
    "preview": "#!/usr/bin/env node\n\nimport commandLineArgs from \"command-line-args\";\nimport { printErrorWithUsage } from \"../print.js\";"
  },
  {
    "path": "pkgs/create-neon/src/cache/npm.ts",
    "chars": 257,
    "preview": "import { Cache } from \"../cache.js\";\n\nexport class NPM implements Cache {\n  readonly org: string;\n  readonly prefix: str"
  },
  {
    "path": "pkgs/create-neon/src/cache.ts",
    "chars": 52,
    "preview": "export interface Cache {\n  readonly type: string;\n}\n"
  },
  {
    "path": "pkgs/create-neon/src/ci/github.ts",
    "chars": 1080,
    "preview": "import handlebars from \"handlebars\";\nimport { CI } from \"../ci.js\";\nimport path from \"node:path\";\n\nconst TEMPLATES: Reco"
  },
  {
    "path": "pkgs/create-neon/src/ci.ts",
    "chars": 142,
    "preview": "export interface CI {\n  readonly type: string;\n  templates(): Record<string, string>;\n  setup(): void;\n  scripts(): Reco"
  },
  {
    "path": "pkgs/create-neon/src/create/app.ts",
    "chars": 697,
    "preview": "import { Creator, ProjectOptions } from \"./creator.js\";\n\nexport class AppCreator extends Creator {\n  constructor(options"
  },
  {
    "path": "pkgs/create-neon/src/create/creator.ts",
    "chars": 4593,
    "preview": "import die from \"../die.js\";\nimport { mktemp } from \"../fs.js\";\nimport * as path from \"node:path\";\nimport * as fs from \""
  },
  {
    "path": "pkgs/create-neon/src/create/lib.ts",
    "chars": 3699,
    "preview": "import { Creator, ProjectOptions, LibraryOptions, Lang } from \"./creator.js\";\nimport { Context } from \"../expand/context"
  },
  {
    "path": "pkgs/create-neon/src/die.ts",
    "chars": 381,
    "preview": "import { promises as fs } from \"fs\";\n\nfunction deleteNeonDir(dir: string): Promise<void> {\n  return fs.rm(dir, { force: "
  },
  {
    "path": "pkgs/create-neon/src/expand/context.ts",
    "chars": 737,
    "preview": "import { ProjectOptions } from \"../create/creator.js\";\nimport { VERSIONS, Versions } from \"./versions.js\";\n\nexport type "
  },
  {
    "path": "pkgs/create-neon/src/expand/index.ts",
    "chars": 955,
    "preview": "import { promises as fs } from \"fs\";\nimport handlebars from \"handlebars\";\nimport helpers from \"handlebars-helpers\";\nimpo"
  },
  {
    "path": "pkgs/create-neon/src/expand/versions.ts",
    "chars": 1932,
    "preview": "// This whole module is a bummer but was the best I could figure out since:\n// - Using @sindresorhus packages like 'chal"
  },
  {
    "path": "pkgs/create-neon/src/fs.ts",
    "chars": 891,
    "preview": "import * as fs from \"node:fs/promises\";\nimport * as path from \"node:path\";\nimport { existsSync, rmSync } from \"node:fs\";"
  },
  {
    "path": "pkgs/create-neon/src/index.ts",
    "chars": 4035,
    "preview": "import { Context } from \"./expand/context.js\";\nimport {\n  NodePlatform,\n  PlatformPreset,\n  isNodePlatform,\n  isPlatform"
  },
  {
    "path": "pkgs/create-neon/src/print.ts",
    "chars": 2911,
    "preview": "import commandLineUsage from \"command-line-usage\";\nimport chalk from \"chalk\";\n\nfunction pink(text: string): string {\n  r"
  },
  {
    "path": "pkgs/create-neon/src/shell.ts",
    "chars": 5344,
    "preview": "import { ChildProcess, spawn } from \"node:child_process\";\nimport { PassThrough, Readable, Writable } from \"node:stream\";"
  },
  {
    "path": "pkgs/create-neon/test/create-neon.ts",
    "chars": 6965,
    "preview": "import { assert } from \"chai\";\nimport { spawn } from \"child_process\";\nimport * as path from \"path\";\nimport { promises as"
  },
  {
    "path": "pkgs/create-neon/tsconfig.json",
    "chars": 313,
    "preview": "{\n  \"extends\": \"@tsconfig/node18/tsconfig.json\",\n  \"compilerOptions\": {\n    \"module\": \"es2022\",\n    \"moduleResolution\": "
  },
  {
    "path": "test/electron/Cargo.toml",
    "chars": 208,
    "preview": "[package]\nname = \"electron-tests\"\nversion = \"0.1.0\"\nedition = \"2021\"\nauthors = [\"The Neon Community\"]\nlicense = \"MIT/Apa"
  },
  {
    "path": "test/electron/README.md",
    "chars": 234,
    "preview": "# neon-electron-quick-start\n\nThis is a minimal Electron application based on the [Quick Start Guide](https://electronjs."
  },
  {
    "path": "test/electron/index.html",
    "chars": 535,
    "preview": "<!DOCTYPE html>\n<html>\n  <head>\n    <meta charset=\"UTF-8\">\n    <!-- https://developer.mozilla.org/en-US/docs/Web/HTTP/CS"
  },
  {
    "path": "test/electron/main.js",
    "chars": 1145,
    "preview": "// Modules to control application life and create native browser window\nconst { app, BrowserWindow } = require(\"electron"
  },
  {
    "path": "test/electron/main.test.js",
    "chars": 479,
    "preview": "\"use strict\";\n\nconst assert = require(\"assert\");\nconst path = require(\"path\");\n\nconst { _electron: electron } = require("
  },
  {
    "path": "test/electron/package.json",
    "chars": 593,
    "preview": "{\n  \"name\": \"electron-tests\",\n  \"version\": \"0.1.0\",\n  \"description\": \"Electron acceptance test suite for Neon\",\n  \"main\""
  },
  {
    "path": "test/electron/preload.js",
    "chars": 163,
    "preview": "const native = require(\"./index.node\");\n\nwindow.addEventListener(\"DOMContentLoaded\", () => {\n  document.getElementById(\""
  },
  {
    "path": "test/electron/renderer.js",
    "chars": 293,
    "preview": "// This file is required by the index.html file and will\n// be executed in the renderer process for that window.\n// No N"
  },
  {
    "path": "test/electron/src/lib.rs",
    "chars": 239,
    "preview": "use neon::prelude::*;\n\nfn hello(mut cx: FunctionContext) -> JsResult<JsString> {\n    Ok(cx.string(\"Hello, World!\"))\n}\n\n#"
  },
  {
    "path": "test/napi/.gitignore",
    "chars": 89,
    "preview": "native/target\nnative/index.node\nnative/artifacts.json\n**/*~\n**/node_modules\n**/.DS_Store\n"
  },
  {
    "path": "test/napi/Cargo.toml",
    "chars": 537,
    "preview": "[package]\nname = \"napi-tests\"\nversion = \"0.1.0\"\nauthors = [\"The Neon Community <david.herman@gmail.com>\"]\nlicense = \"MIT"
  },
  {
    "path": "test/napi/README.md",
    "chars": 58,
    "preview": "# napi\n\nAcceptance test suite for Neon with N-API backend\n"
  },
  {
    "path": "test/napi/lib/arrays.js",
    "chars": 755,
    "preview": "var addon = require(\"..\");\nvar assert = require(\"chai\").assert;\n\ndescribe(\"JsArray\", function () {\n  it(\"return a JsArra"
  },
  {
    "path": "test/napi/lib/bigint.js",
    "chars": 168,
    "preview": "const addon = require(\"..\");\n\ndescribe(\"JsBigInt\", () => {\n  const suite = addon.bigint_suite();\n\n  for (const [k, v] of"
  },
  {
    "path": "test/napi/lib/boxed.js",
    "chars": 1795,
    "preview": "const addon = require(\"..\");\nconst { expect } = require(\"chai\");\nconst assert = require(\"chai\").assert;\n\nclass Person {\n"
  },
  {
    "path": "test/napi/lib/class.js",
    "chars": 27976,
    "preview": "const addon = require(\"..\");\nconst assert = require(\"chai\").assert;\n\ndescribe(\"wrapping\", function () {\n  it(\"should be "
  },
  {
    "path": "test/napi/lib/coercions.js",
    "chars": 348,
    "preview": "var addon = require(\"..\");\nvar assert = require(\"chai\").assert;\n\ndescribe(\"coercions\", function () {\n  it(\"can stringify"
  },
  {
    "path": "test/napi/lib/container.js",
    "chars": 2455,
    "preview": "const addon = require(\"..\");\nconst { expect } = require(\"chai\");\nconst assert = require(\"chai\").assert;\n\ndescribe(\"Conta"
  },
  {
    "path": "test/napi/lib/date.js",
    "chars": 1159,
    "preview": "var addon = require(\"..\");\nvar assert = require(\"chai\").assert;\n\ndescribe(\"JsDate\", function () {\n  it(\"should create a "
  },
  {
    "path": "test/napi/lib/errors.js",
    "chars": 1174,
    "preview": "const addon = require(\"..\");\nconst assert = require(\"chai\").assert;\n\ndescribe(\"errors\", function () {\n  it(\"should be ab"
  },
  {
    "path": "test/napi/lib/export.js",
    "chars": 6605,
    "preview": "const assert = require(\"assert\");\n\nconst addon = require(\"..\");\n\ndescribe(\"neon::export macro\", () => {\n  describe(\"glob"
  },
  {
    "path": "test/napi/lib/extract.js",
    "chars": 2956,
    "preview": "const assert = require(\"assert\");\n\nconst addon = require(\"..\");\n\ndescribe(\"Extractors\", () => {\n  it(\"Single Argument\", "
  },
  {
    "path": "test/napi/lib/functions.js",
    "chars": 10949,
    "preview": "var addon = require(\"..\");\nvar assert = require(\"chai\").assert;\n\nconst STRICT = function () {\n  \"use strict\";\n  return t"
  },
  {
    "path": "test/napi/lib/futures.js",
    "chars": 2859,
    "preview": "const assert = require(\"assert\");\n\nconst addon = require(\"..\");\n\nasync function assertRejects(f, ...args) {\n  try {\n    "
  },
  {
    "path": "test/napi/lib/hello.js",
    "chars": 981,
    "preview": "var addon = require(\"..\");\nvar assert = require(\"chai\").assert;\n\ndescribe(\"hello\", function () {\n  it(\"should export a g"
  },
  {
    "path": "test/napi/lib/numbers.js",
    "chars": 1834,
    "preview": "var addon = require(\"..\");\nvar assert = require(\"chai\").assert;\n\ndescribe(\"JsNumber\", function () {\n  it(\"return a JsNum"
  },
  {
    "path": "test/napi/lib/objects.js",
    "chars": 4459,
    "preview": "var addon = require(\"..\");\nvar assert = require(\"chai\").assert;\n\ndescribe(\"JsObject\", function () {\n  it(\"return the v8:"
  },
  {
    "path": "test/napi/lib/strings.js",
    "chars": 1295,
    "preview": "var addon = require(\"..\");\nvar { assert, expect } = require(\"chai\");\n\ndescribe(\"JsString\", function () {\n  it(\"should re"
  },
  {
    "path": "test/napi/lib/threads.js",
    "chars": 14386,
    "preview": "const addon = require(\"..\");\nconst assert = require(\"chai\").assert;\n\n(function () {\n  // These tests require GC exposed "
  },
  {
    "path": "test/napi/lib/typedarrays.js",
    "chars": 18580,
    "preview": "var addon = require(\"..\");\nvar assert = require(\"chai\").assert;\n\nconst { Worker, isMainThread, parentPort } = require(\"w"
  },
  {
    "path": "test/napi/lib/types.js",
    "chars": 2915,
    "preview": "var addon = require(\"..\");\nvar assert = require(\"chai\").assert;\n\ndescribe(\"type checks\", function () {\n  it(\"is_array\", "
  },
  {
    "path": "test/napi/lib/workers.js",
    "chars": 6275,
    "preview": "const assert = require(\"assert\");\nconst {\n  Worker,\n  isMainThread,\n  parentPort,\n  threadId,\n  workerData,\n} = require("
  },
  {
    "path": "test/napi/package.json",
    "chars": 497,
    "preview": "{\n  \"name\": \"napi-tests\",\n  \"version\": \"0.1.0\",\n  \"description\": \"Acceptance test suite for Neon with N-API backend\",\n  "
  },
  {
    "path": "test/napi/src/js/arrays.rs",
    "chars": 762,
    "preview": "use neon::prelude::*;\n\npub fn return_js_array(mut cx: FunctionContext) -> JsResult<JsArray> {\n    Ok(cx.empty_array())\n}"
  },
  {
    "path": "test/napi/src/js/bigint.rs",
    "chars": 14618,
    "preview": "/// Tests for [`JsBigInt`]. All unit tests are prefixed with `test_` and exported by\n/// [`bigint_suite`].\nuse std::{any"
  },
  {
    "path": "test/napi/src/js/boxed.rs",
    "chars": 2287,
    "preview": "use std::cell::RefCell;\n\nuse neon::{prelude::*, types::extract::Boxed};\n\npub struct Person {\n    name: String,\n}\n\nimpl F"
  },
  {
    "path": "test/napi/src/js/class.rs",
    "chars": 15449,
    "preview": "use std::{collections::HashMap, future::Future};\n\nuse neon::{event::Channel, prelude::*, types::extract::Json};\n\n#[neon:"
  }
]

// ... and 80 more files (download for full content)

About this extraction

This page contains the full source code of the neon-bindings/neon GitHub repository, extracted and formatted as plain text for AI agents and large language models (LLMs). The extraction includes 280 files (1001.0 KB), approximately 274.2k tokens, and a symbol index with 1851 extracted functions, classes, methods, constants, and types. Use this with OpenClaw, Claude, ChatGPT, Cursor, Windsurf, or any other AI tool that accepts text input. You can copy the full output to your clipboard or download it as a .txt file.

Extracted by GitExtract — free GitHub repo to text converter for AI. Built by Nikandr Surkov.

Copied to clipboard!