repo stringlengths 6 65 | file_url stringlengths 81 311 | file_path stringlengths 6 227 | content stringlengths 0 32.8k | language stringclasses 1
value | license stringclasses 7
values | commit_sha stringlengths 40 40 | retrieved_at stringdate 2026-01-04 15:31:58 2026-01-04 20:25:31 | truncated bool 2
classes |
|---|---|---|---|---|---|---|---|---|
neon-bindings/neon | https://github.com/neon-bindings/neon/blob/22098e4d9f1c4b29447671298bc839476b6826dc/test/ui/tests/fail/class-multiple-finalizers.rs | test/ui/tests/fail/class-multiple-finalizers.rs | struct Example;
#[neon::class]
impl Example {
fn finalize<'a, C: neon::context::Context<'a>>(self, _cx: &mut C) {}
fn finalize<'a, C: neon::context::Context<'a>>(self, _cx: &mut C) {}
}
fn main() {}
| rust | Apache-2.0 | 22098e4d9f1c4b29447671298bc839476b6826dc | 2026-01-04T15:47:42.000902Z | false |
neon-bindings/neon | https://github.com/neon-bindings/neon/blob/22098e4d9f1c4b29447671298bc839476b6826dc/test/ui/tests/fail/class-invalid-item-type.rs | test/ui/tests/fail/class-invalid-item-type.rs | struct Example;
#[neon::class]
impl Example {
type AssocType = i32;
}
fn main() {}
| rust | Apache-2.0 | 22098e4d9f1c4b29447671298bc839476b6826dc | 2026-01-04T15:47:42.000902Z | false |
neon-bindings/neon | https://github.com/neon-bindings/neon/blob/22098e4d9f1c4b29447671298bc839476b6826dc/test/ui/tests/fail/class-async-fn-borrowed-self.rs | test/ui/tests/fail/class-async-fn-borrowed-self.rs | #[derive(Clone)]
struct Example;
#[neon::class]
impl Example {
async fn method(&self) {}
}
fn main() {}
| rust | Apache-2.0 | 22098e4d9f1c4b29447671298bc839476b6826dc | 2026-01-04T15:47:42.000902Z | false |
neon-bindings/neon | https://github.com/neon-bindings/neon/blob/22098e4d9f1c4b29447671298bc839476b6826dc/test/ui/tests/fail/class-constructor-self-receiver.rs | test/ui/tests/fail/class-constructor-self-receiver.rs | struct Example;
#[neon::class]
impl Example {
fn new(&self) -> Self {
Example
}
}
fn main() {}
| rust | Apache-2.0 | 22098e4d9f1c4b29447671298bc839476b6826dc | 2026-01-04T15:47:42.000902Z | false |
neon-bindings/neon | https://github.com/neon-bindings/neon/blob/22098e4d9f1c4b29447671298bc839476b6826dc/test/ui/tests/fail/class-constructor-with-self.rs | test/ui/tests/fail/class-constructor-with-self.rs | struct Example;
#[neon::class]
impl Example {
fn new(self) -> Self {
self
}
}
fn main() {}
| rust | Apache-2.0 | 22098e4d9f1c4b29447671298bc839476b6826dc | 2026-01-04T15:47:42.000902Z | false |
neon-bindings/neon | https://github.com/neon-bindings/neon/blob/22098e4d9f1c4b29447671298bc839476b6826dc/test/ui/tests/fail/class-duplicate-property-names.rs | test/ui/tests/fail/class-duplicate-property-names.rs | struct Example;
#[neon::class]
impl Example {
#[neon(name = "value")]
const VALUE1: i32 = 42;
#[neon(name = "value")]
const VALUE2: i32 = 43;
}
fn main() {}
| rust | Apache-2.0 | 22098e4d9f1c4b29447671298bc839476b6826dc | 2026-01-04T15:47:42.000902Z | false |
neon-bindings/neon | https://github.com/neon-bindings/neon/blob/22098e4d9f1c4b29447671298bc839476b6826dc/test/ui/tests/fail/class-async-owned-context.rs | test/ui/tests/fail/class-async-owned-context.rs | use neon::prelude::*;
struct Example;
#[neon::class]
impl Example {
#[neon(async)]
fn method(&self, _cx: FunctionContext) {}
}
fn main() {}
| rust | Apache-2.0 | 22098e4d9f1c4b29447671298bc839476b6826dc | 2026-01-04T15:47:42.000902Z | false |
neon-bindings/neon | https://github.com/neon-bindings/neon/blob/22098e4d9f1c4b29447671298bc839476b6826dc/test/ui/tests/fail/class-immutable-context.rs | test/ui/tests/fail/class-immutable-context.rs | use neon::prelude::*;
struct Example;
#[neon::class]
impl Example {
fn method(&self, _cx: &FunctionContext) {}
}
fn main() {}
| rust | Apache-2.0 | 22098e4d9f1c4b29447671298bc839476b6826dc | 2026-01-04T15:47:42.000902Z | false |
neon-bindings/neon | https://github.com/neon-bindings/neon/blob/22098e4d9f1c4b29447671298bc839476b6826dc/test/ui/tests/fail/missing-context.rs | test/ui/tests/fail/missing-context.rs | #[neon::export(context)]
fn missing_context() {}
fn main() {}
| rust | Apache-2.0 | 22098e4d9f1c4b29447671298bc839476b6826dc | 2026-01-04T15:47:42.000902Z | false |
neon-bindings/neon | https://github.com/neon-bindings/neon/blob/22098e4d9f1c4b29447671298bc839476b6826dc/test/ui/tests/fail/unexpected-self.rs | test/ui/tests/fail/unexpected-self.rs | struct Example;
impl Example {
#[neon::export]
fn borrow(&self) {}
#[neon::export]
fn borrow_mut(&mut self) {}
#[neon::export]
fn owned(self) {}
}
fn main() {}
| rust | Apache-2.0 | 22098e4d9f1c4b29447671298bc839476b6826dc | 2026-01-04T15:47:42.000902Z | false |
neon-bindings/neon | https://github.com/neon-bindings/neon/blob/22098e4d9f1c4b29447671298bc839476b6826dc/test/ui/tests/fail/class-owned-context.rs | test/ui/tests/fail/class-owned-context.rs | use neon::prelude::*;
struct Example;
#[neon::class]
impl Example {
fn method(&self, _cx: FunctionContext) {}
}
fn main() {}
| rust | Apache-2.0 | 22098e4d9f1c4b29447671298bc839476b6826dc | 2026-01-04T15:47:42.000902Z | false |
neon-bindings/neon | https://github.com/neon-bindings/neon/blob/22098e4d9f1c4b29447671298bc839476b6826dc/test/ui/tests/fail/class-multiple-neon-attrs-method.rs | test/ui/tests/fail/class-multiple-neon-attrs-method.rs | struct Example;
#[neon::class]
impl Example {
#[neon(async)]
#[neon(task)]
fn method(&self) {}
}
fn main() {}
| rust | Apache-2.0 | 22098e4d9f1c4b29447671298bc839476b6826dc | 2026-01-04T15:47:42.000902Z | false |
neon-bindings/neon | https://github.com/neon-bindings/neon/blob/22098e4d9f1c4b29447671298bc839476b6826dc/test/ui/tests/fail/class-multiple-neon-attrs-const.rs | test/ui/tests/fail/class-multiple-neon-attrs-const.rs | struct Example;
#[neon::class]
impl Example {
#[neon(name = "foo")]
#[neon(json)]
const VALUE: i32 = 42;
}
fn main() {}
| rust | Apache-2.0 | 22098e4d9f1c4b29447671298bc839476b6826dc | 2026-01-04T15:47:42.000902Z | false |
neon-bindings/neon | https://github.com/neon-bindings/neon/blob/22098e4d9f1c4b29447671298bc839476b6826dc/test/ui/tests/fail/class-missing-forced-context.rs | test/ui/tests/fail/class-missing-forced-context.rs | struct Example;
#[neon::class]
impl Example {
#[neon(context)]
fn method(&self) {}
}
fn main() {}
| rust | Apache-2.0 | 22098e4d9f1c4b29447671298bc839476b6826dc | 2026-01-04T15:47:42.000902Z | false |
neon-bindings/neon | https://github.com/neon-bindings/neon/blob/22098e4d9f1c4b29447671298bc839476b6826dc/test/ui/tests/fail/class-multiple-constructors.rs | test/ui/tests/fail/class-multiple-constructors.rs | struct Example;
#[neon::class]
impl Example {
fn new() -> Self {
Example
}
fn new() -> Self {
Example
}
}
fn main() {}
| rust | Apache-2.0 | 22098e4d9f1c4b29447671298bc839476b6826dc | 2026-01-04T15:47:42.000902Z | false |
neon-bindings/neon | https://github.com/neon-bindings/neon/blob/22098e4d9f1c4b29447671298bc839476b6826dc/test/ui/tests/fail/unsupported-property.rs | test/ui/tests/fail/unsupported-property.rs | #[neon::export(foo)]
static STRING: &str = "";
#[neon::export(foo)]
fn unsupported() {}
fn main() {}
| rust | Apache-2.0 | 22098e4d9f1c4b29447671298bc839476b6826dc | 2026-01-04T15:47:42.000902Z | false |
neon-bindings/neon | https://github.com/neon-bindings/neon/blob/22098e4d9f1c4b29447671298bc839476b6826dc/test/ui/tests/fail/class-borrowed-channel-sync.rs | test/ui/tests/fail/class-borrowed-channel-sync.rs | use neon::prelude::*;
struct Example;
#[neon::class]
impl Example {
fn method(&self, _ch: &Channel) {}
}
fn main() {}
| rust | Apache-2.0 | 22098e4d9f1c4b29447671298bc839476b6826dc | 2026-01-04T15:47:42.000902Z | false |
neon-bindings/neon | https://github.com/neon-bindings/neon/blob/22098e4d9f1c4b29447671298bc839476b6826dc/test/ui/tests/fail/missing-class-default.rs | test/ui/tests/fail/missing-class-default.rs | struct Point {
x: i32,
y: i32,
}
#[neon::class]
impl Point {
}
fn main() {}
| rust | Apache-2.0 | 22098e4d9f1c4b29447671298bc839476b6826dc | 2026-01-04T15:47:42.000902Z | false |
neon-bindings/neon | https://github.com/neon-bindings/neon/blob/22098e4d9f1c4b29447671298bc839476b6826dc/test/ui/tests/fail/class-async-context-ref.rs | test/ui/tests/fail/class-async-context-ref.rs | use neon::prelude::*;
struct Example;
#[neon::class]
impl Example {
#[neon(async)]
fn method(&self, _cx: &mut FunctionContext) {}
}
fn main() {}
| rust | Apache-2.0 | 22098e4d9f1c4b29447671298bc839476b6826dc | 2026-01-04T15:47:42.000902Z | false |
neon-bindings/neon | https://github.com/neon-bindings/neon/blob/22098e4d9f1c4b29447671298bc839476b6826dc/test/ui/tests/fail/class-channel-in-sync.rs | test/ui/tests/fail/class-channel-in-sync.rs | use neon::prelude::*;
struct Example;
#[neon::class]
impl Example {
fn method(&self, _ch: Channel) {}
}
fn main() {}
| rust | Apache-2.0 | 22098e4d9f1c4b29447671298bc839476b6826dc | 2026-01-04T15:47:42.000902Z | false |
neon-bindings/neon | https://github.com/neon-bindings/neon/blob/22098e4d9f1c4b29447671298bc839476b6826dc/test/ui/tests/fail/missing-class-clone.rs | test/ui/tests/fail/missing-class-clone.rs | struct Point {
x: i32,
y: i32,
}
#[neon::class]
impl Point {
fn new(x: i32, y: i32) -> Self {
Point { x, y }
}
fn equals(&self, other: Point) -> bool {
self.x == other.x && self.y == other.y
}
}
fn main() {}
| rust | Apache-2.0 | 22098e4d9f1c4b29447671298bc839476b6826dc | 2026-01-04T15:47:42.000902Z | false |
neon-bindings/neon | https://github.com/neon-bindings/neon/blob/22098e4d9f1c4b29447671298bc839476b6826dc/test/ui/tests/fail/class-method-missing-self.rs | test/ui/tests/fail/class-method-missing-self.rs | struct Example;
#[neon::class]
impl Example {
fn method() {}
}
fn main() {}
| rust | Apache-2.0 | 22098e4d9f1c4b29447671298bc839476b6826dc | 2026-01-04T15:47:42.000902Z | false |
neon-bindings/neon | https://github.com/neon-bindings/neon/blob/22098e4d9f1c4b29447671298bc839476b6826dc/test/ui/tests/pass/globals.rs | test/ui/tests/pass/globals.rs | #[neon::export]
static STATIC_STRING: &str = "";
#[neon::export]
const CONST_NUMBER: f64 = 42.0;
#[neon::export]
static STATIC_ARR: &[f64] = &[42.0];
#[neon::export(json)]
static ARR_OF_ARR: &[&[f64]] = &[&[42.0]];
fn main() {}
| rust | Apache-2.0 | 22098e4d9f1c4b29447671298bc839476b6826dc | 2026-01-04T15:47:42.000902Z | false |
neon-bindings/neon | https://github.com/neon-bindings/neon/blob/22098e4d9f1c4b29447671298bc839476b6826dc/test/ui/tests/pass/json.rs | test/ui/tests/pass/json.rs | #[neon::export(json)]
fn wrap_with_json(v: Vec<String>) -> Vec<String> {
v
}
fn main() {}
| rust | Apache-2.0 | 22098e4d9f1c4b29447671298bc839476b6826dc | 2026-01-04T15:47:42.000902Z | false |
neon-bindings/neon | https://github.com/neon-bindings/neon/blob/22098e4d9f1c4b29447671298bc839476b6826dc/test/ui/tests/pass/context-and-this.rs | test/ui/tests/pass/context-and-this.rs | use std::future::Future;
use neon::{
context::{Context, Cx, FunctionContext},
event::Channel,
handle::Handle,
types::{extract::Boxed, JsString},
};
type Ch = Channel;
type FnCx<'cx> = FunctionContext<'cx>;
#[neon::export]
fn sync_nothing() {}
#[neon::export]
fn sync_function_context(_cx: &mut Functi... | rust | Apache-2.0 | 22098e4d9f1c4b29447671298bc839476b6826dc | 2026-01-04T15:47:42.000902Z | false |
neon-bindings/neon | https://github.com/neon-bindings/neon/blob/22098e4d9f1c4b29447671298bc839476b6826dc/test/rust-2024/src/lib.rs | test/rust-2024/src/lib.rs | #[neon::export]
fn hello() -> String {
"hello node".to_string()
}
| rust | Apache-2.0 | 22098e4d9f1c4b29447671298bc839476b6826dc | 2026-01-04T15:47:42.000902Z | false |
neon-bindings/neon | https://github.com/neon-bindings/neon/blob/22098e4d9f1c4b29447671298bc839476b6826dc/crates/neon-macros/src/lib.rs | crates/neon-macros/src/lib.rs | //! Procedural macros supporting [Neon](https://docs.rs/neon/latest/neon/)
mod class;
mod export;
pub(crate) mod name;
#[proc_macro_attribute]
pub fn main(
_attr: proc_macro::TokenStream,
item: proc_macro::TokenStream,
) -> proc_macro::TokenStream {
let syn::ItemFn {
attrs,
vis,
si... | rust | Apache-2.0 | 22098e4d9f1c4b29447671298bc839476b6826dc | 2026-01-04T15:47:42.000902Z | false |
neon-bindings/neon | https://github.com/neon-bindings/neon/blob/22098e4d9f1c4b29447671298bc839476b6826dc/crates/neon-macros/src/name.rs | crates/neon-macros/src/name.rs | // Convert identifiers to camel case with the following rules:
// * All leading and trailing underscores are preserved
// * All other underscores are removed
// * Characters immediately following a non-leading underscore are uppercased
// * Bail (no conversion) if an unexpected condition is encountered:
// - Uppercas... | rust | Apache-2.0 | 22098e4d9f1c4b29447671298bc839476b6826dc | 2026-01-04T15:47:42.000902Z | false |
neon-bindings/neon | https://github.com/neon-bindings/neon/blob/22098e4d9f1c4b29447671298bc839476b6826dc/crates/neon-macros/src/class/mod.rs | crates/neon-macros/src/class/mod.rs | mod meta;
use super::name::is_valid_js_identifier;
use proc_macro2::TokenStream;
use syn::{spanned::Spanned, Ident, ImplItemFn, Type};
struct ClassItems {
consts: Vec<syn::ImplItemConst>,
fns: Vec<syn::ImplItemFn>,
constructor: Option<syn::ImplItemFn>,
has_finalizer: bool,
}
// Check if a method rece... | rust | Apache-2.0 | 22098e4d9f1c4b29447671298bc839476b6826dc | 2026-01-04T15:47:42.000902Z | true |
neon-bindings/neon | https://github.com/neon-bindings/neon/blob/22098e4d9f1c4b29447671298bc839476b6826dc/crates/neon-macros/src/class/meta.rs | crates/neon-macros/src/class/meta.rs | #[derive(Default)]
pub(crate) struct Meta {
pub(super) kind: Kind,
pub(super) name: Option<syn::LitStr>,
pub(super) json: bool,
pub(super) context: bool,
pub(super) this: bool,
}
#[derive(Default)]
pub(super) enum Kind {
Async,
AsyncFn,
#[default]
Normal,
Task,
}
// Property me... | rust | Apache-2.0 | 22098e4d9f1c4b29447671298bc839476b6826dc | 2026-01-04T15:47:42.000902Z | false |
neon-bindings/neon | https://github.com/neon-bindings/neon/blob/22098e4d9f1c4b29447671298bc839476b6826dc/crates/neon-macros/src/export/class.rs | crates/neon-macros/src/export/class.rs | use proc_macro2::TokenStream;
use quote::quote;
use syn::spanned::Spanned;
pub(crate) mod meta;
pub(super) fn export(meta: meta::Meta, input: syn::ItemImpl) -> proc_macro::TokenStream {
// Extract the class name from the impl block
let class_ident = match extract_class_ident(&input) {
Ok(ident) => ide... | rust | Apache-2.0 | 22098e4d9f1c4b29447671298bc839476b6826dc | 2026-01-04T15:47:42.000902Z | false |
neon-bindings/neon | https://github.com/neon-bindings/neon/blob/22098e4d9f1c4b29447671298bc839476b6826dc/crates/neon-macros/src/export/mod.rs | crates/neon-macros/src/export/mod.rs | mod class;
mod function;
mod global;
// N.B.: Meta attribute parsing happens in this function because `syn::parse_macro_input!`
// must be called from a function that returns `proc_macro::TokenStream`.
pub(crate) fn export(
attr: proc_macro::TokenStream,
item: proc_macro::TokenStream,
) -> proc_macro::TokenStr... | rust | Apache-2.0 | 22098e4d9f1c4b29447671298bc839476b6826dc | 2026-01-04T15:47:42.000902Z | false |
neon-bindings/neon | https://github.com/neon-bindings/neon/blob/22098e4d9f1c4b29447671298bc839476b6826dc/crates/neon-macros/src/export/global/mod.rs | crates/neon-macros/src/export/global/mod.rs | pub(crate) mod meta;
// Create a new block expression for the RHS of an assignment
pub(super) fn export(meta: meta::Meta, name: &syn::Ident, expr: Box<syn::Expr>) -> Box<syn::Expr> {
// Name for the registered create function
let create_name = quote::format_ident!("__NEON_EXPORT_CREATE__{name}");
// Defau... | rust | Apache-2.0 | 22098e4d9f1c4b29447671298bc839476b6826dc | 2026-01-04T15:47:42.000902Z | false |
neon-bindings/neon | https://github.com/neon-bindings/neon/blob/22098e4d9f1c4b29447671298bc839476b6826dc/crates/neon-macros/src/export/global/meta.rs | crates/neon-macros/src/export/global/meta.rs | #[derive(Default)]
pub(crate) struct Meta {
pub(super) name: Option<syn::LitStr>,
pub(super) json: bool,
}
pub(crate) struct Parser;
impl syn::parse::Parser for Parser {
type Output = Meta;
fn parse2(self, tokens: proc_macro2::TokenStream) -> syn::Result<Self::Output> {
let mut attr = Meta::d... | rust | Apache-2.0 | 22098e4d9f1c4b29447671298bc839476b6826dc | 2026-01-04T15:47:42.000902Z | false |
neon-bindings/neon | https://github.com/neon-bindings/neon/blob/22098e4d9f1c4b29447671298bc839476b6826dc/crates/neon-macros/src/export/class/meta.rs | crates/neon-macros/src/export/class/meta.rs | use syn::parse::{Parse, ParseStream};
/// Metadata for class exports
#[derive(Default)]
pub(crate) struct Meta {
/// Name for the JavaScript class itself (used in class definition)
pub class_name: Option<String>,
/// Name for the module export binding
pub export_name: Option<String>,
}
impl Parse for ... | rust | Apache-2.0 | 22098e4d9f1c4b29447671298bc839476b6826dc | 2026-01-04T15:47:42.000902Z | false |
neon-bindings/neon | https://github.com/neon-bindings/neon/blob/22098e4d9f1c4b29447671298bc839476b6826dc/crates/neon-macros/src/export/function/mod.rs | crates/neon-macros/src/export/function/mod.rs | use syn::spanned::Spanned;
use crate::export::function::meta::Kind;
pub(crate) mod meta;
pub(super) fn export(meta: meta::Meta, input: syn::ItemFn) -> proc_macro::TokenStream {
let syn::ItemFn {
attrs,
vis,
sig,
block,
} = input;
let name = &sig.ident;
// Generate th... | rust | Apache-2.0 | 22098e4d9f1c4b29447671298bc839476b6826dc | 2026-01-04T15:47:42.000902Z | false |
neon-bindings/neon | https://github.com/neon-bindings/neon/blob/22098e4d9f1c4b29447671298bc839476b6826dc/crates/neon-macros/src/export/function/meta.rs | crates/neon-macros/src/export/function/meta.rs | #[derive(Default)]
pub(crate) struct Meta {
pub(super) kind: Kind,
pub(super) name: Option<syn::LitStr>,
pub(super) json: bool,
pub(super) context: bool,
pub(super) this: bool,
}
#[derive(Default)]
pub(super) enum Kind {
Async,
AsyncFn,
#[default]
Normal,
Task,
}
impl Meta {
... | rust | Apache-2.0 | 22098e4d9f1c4b29447671298bc839476b6826dc | 2026-01-04T15:47:42.000902Z | false |
neon-bindings/neon | https://github.com/neon-bindings/neon/blob/22098e4d9f1c4b29447671298bc839476b6826dc/crates/neon/src/types_docs.rs | crates/neon/src/types_docs.rs | #[cfg_attr(feature = "aquamarine", aquamarine::aquamarine)]
/// Representations of JavaScript's core builtin types.
///
/// ## Modeling JavaScript Types
///
/// All JavaScript values in Neon implement the abstract [`Value`](crate::types::Value)
/// trait, which is the most generic way to work with JavaScript values. Ne... | rust | Apache-2.0 | 22098e4d9f1c4b29447671298bc839476b6826dc | 2026-01-04T15:47:42.000902Z | false |
neon-bindings/neon | https://github.com/neon-bindings/neon/blob/22098e4d9f1c4b29447671298bc839476b6826dc/crates/neon/src/prelude.rs | crates/neon/src/prelude.rs | //! Convenience module for the most common Neon imports.
#[doc(no_inline)]
pub use crate::{
context::{CallKind, Context, Cx, FunctionContext, ModuleContext},
handle::{Handle, Root},
object::Object,
result::{JsResult, NeonResult, ResultExt as NeonResultExt},
types::{
boxed::{Finalize, JsBox}... | rust | Apache-2.0 | 22098e4d9f1c4b29447671298bc839476b6826dc | 2026-01-04T15:47:42.000902Z | false |
neon-bindings/neon | https://github.com/neon-bindings/neon/blob/22098e4d9f1c4b29447671298bc839476b6826dc/crates/neon/src/lib.rs | 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 spec... | rust | Apache-2.0 | 22098e4d9f1c4b29447671298bc839476b6826dc | 2026-01-04T15:47:42.000902Z | false |
neon-bindings/neon | https://github.com/neon-bindings/neon/blob/22098e4d9f1c4b29447671298bc839476b6826dc/crates/neon/src/reflect.rs | crates/neon/src/reflect.rs | //! Exposes JavaScript's reflection API to Rust.
use crate::{
context::Context,
handle::Handle,
result::JsResult,
types::{build, private::ValueInternal, JsString, JsValue},
};
pub fn eval<'a, 'b, C: Context<'a>>(
cx: &mut C,
script: Handle<'b, JsString>,
) -> JsResult<'a, JsValue> {
let en... | rust | Apache-2.0 | 22098e4d9f1c4b29447671298bc839476b6826dc | 2026-01-04T15:47:42.000902Z | false |
neon-bindings/neon | https://github.com/neon-bindings/neon/blob/22098e4d9f1c4b29447671298bc839476b6826dc/crates/neon/src/lifecycle.rs | 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]... | rust | Apache-2.0 | 22098e4d9f1c4b29447671298bc839476b6826dc | 2026-01-04T15:47:42.000902Z | false |
neon-bindings/neon | https://github.com/neon-bindings/neon/blob/22098e4d9f1c4b29447671298bc839476b6826dc/crates/neon/src/macros.rs | 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 cons... | rust | Apache-2.0 | 22098e4d9f1c4b29447671298bc839476b6826dc | 2026-01-04T15:47:42.000902Z | false |
neon-bindings/neon | https://github.com/neon-bindings/neon/blob/22098e4d9f1c4b29447671298bc839476b6826dc/crates/neon/src/meta.rs | crates/neon/src/meta.rs | //! Metadata about the Neon version and build.
use semver::Version;
/// The Neon version.
pub const VERSION: &str = env!("CARGO_PKG_VERSION");
/// The Neon major version.
pub const MAJOR: &str = env!("CARGO_PKG_VERSION_MAJOR");
/// The Neon minor version.
pub const MINOR: &str = env!("CARGO_PKG_VERSION_MINOR");
//... | rust | Apache-2.0 | 22098e4d9f1c4b29447671298bc839476b6826dc | 2026-01-04T15:47:42.000902Z | false |
neon-bindings/neon | https://github.com/neon-bindings/neon/blob/22098e4d9f1c4b29447671298bc839476b6826dc/crates/neon/src/macro_internal/futures.rs | 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) -> JsResul... | rust | Apache-2.0 | 22098e4d9f1c4b29447671298bc839476b6826dc | 2026-01-04T15:47:42.000902Z | false |
neon-bindings/neon | https://github.com/neon-bindings/neon/blob/22098e4d9f1c4b29447671298bc839476b6826dc/crates/neon/src/macro_internal/mod.rs | 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 cr... | rust | Apache-2.0 | 22098e4d9f1c4b29447671298bc839476b6826dc | 2026-01-04T15:47:42.000902Z | false |
neon-bindings/neon | https://github.com/neon-bindings/neon/blob/22098e4d9f1c4b29447671298bc839476b6826dc/crates/neon/src/thread/mod.rs | crates/neon/src/thread/mod.rs | //! Thread-local storage for JavaScript threads.
//!
//! At runtime, an instance of a Node.js addon can contain its own local storage,
//! which can then be shared and accessed as needed from Rust in a Neon module. This can
//! be useful for setting up long-lived state that needs to be shared between calls
//! of an ad... | rust | Apache-2.0 | 22098e4d9f1c4b29447671298bc839476b6826dc | 2026-01-04T15:47:42.000902Z | false |
neon-bindings/neon | https://github.com/neon-bindings/neon/blob/22098e4d9f1c4b29447671298bc839476b6826dc/crates/neon/src/result/mod.rs | crates/neon/src/result/mod.rs | //! Represents JavaScript exceptions as a Rust [`Result`](std::result) type.
//!
//! Most interactions with the JavaScript engine can throw a JavaScript exception. Neon APIs
//! that can throw an exception are called _throwing APIs_ and return the type
//! [`NeonResult`] (or its shorthand [`JsResult`]).
//!
//! When a ... | rust | Apache-2.0 | 22098e4d9f1c4b29447671298bc839476b6826dc | 2026-01-04T15:47:42.000902Z | false |
neon-bindings/neon | https://github.com/neon-bindings/neon/blob/22098e4d9f1c4b29447671298bc839476b6826dc/crates/neon/src/object/class.rs | crates/neon/src/object/class.rs | use crate::{
context::Cx,
handle::{Handle, Root},
object::Object,
result::{JsResult, NeonResult},
types::JsFunction,
};
#[doc(hidden)]
pub trait ClassInternal {
fn local<'cx>(cx: &mut Cx<'cx>) -> NeonResult<ClassMetadata<'cx>>;
fn create<'cx>(cx: &mut Cx<'cx>) -> NeonResult<ClassMetadata<'c... | rust | Apache-2.0 | 22098e4d9f1c4b29447671298bc839476b6826dc | 2026-01-04T15:47:42.000902Z | false |
neon-bindings/neon | https://github.com/neon-bindings/neon/blob/22098e4d9f1c4b29447671298bc839476b6826dc/crates/neon/src/object/mod.rs | crates/neon/src/object/mod.rs | //! Traits for working with JavaScript objects.
//!
//! This module defines the [`Object`] trait, which is implemented
//! by all object types in the [JavaScript type hierarchy][hierarchy]. This
//! trait provides key operations in the semantics of JavaScript objects,
//! such as getting and setting an object's propert... | rust | Apache-2.0 | 22098e4d9f1c4b29447671298bc839476b6826dc | 2026-01-04T15:47:42.000902Z | false |
neon-bindings/neon | https://github.com/neon-bindings/neon/blob/22098e4d9f1c4b29447671298bc839476b6826dc/crates/neon/src/object/wrap.rs | crates/neon/src/object/wrap.rs | use std::{any::Any, error, ffi::c_void, fmt, mem::MaybeUninit, ptr};
use crate::{
context::{
internal::{ContextInternal, Env},
Context, Cx,
},
handle::Handle,
object::Object,
result::{JsResult, NeonResult, ResultExt, Throw},
sys,
types::{extract::TryIntoJs, Finalize, Value},... | rust | Apache-2.0 | 22098e4d9f1c4b29447671298bc839476b6826dc | 2026-01-04T15:47:42.000902Z | false |
neon-bindings/neon | https://github.com/neon-bindings/neon/blob/22098e4d9f1c4b29447671298bc839476b6826dc/crates/neon/src/handle/internal.rs | 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 b... | rust | Apache-2.0 | 22098e4d9f1c4b29447671298bc839476b6826dc | 2026-01-04T15:47:42.000902Z | false |
neon-bindings/neon | https://github.com/neon-bindings/neon/blob/22098e4d9f1c4b29447671298bc839476b6826dc/crates/neon/src/handle/root.rs | 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... | rust | Apache-2.0 | 22098e4d9f1c4b29447671298bc839476b6826dc | 2026-01-04T15:47:42.000902Z | false |
neon-bindings/neon | https://github.com/neon-bindings/neon/blob/22098e4d9f1c4b29447671298bc839476b6826dc/crates/neon/src/handle/mod.rs | 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`... | rust | Apache-2.0 | 22098e4d9f1c4b29447671298bc839476b6826dc | 2026-01-04T15:47:42.000902Z | false |
neon-bindings/neon | https://github.com/neon-bindings/neon/blob/22098e4d9f1c4b29447671298bc839476b6826dc/crates/neon/src/event/mod.rs | 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][tim... | rust | Apache-2.0 | 22098e4d9f1c4b29447671298bc839476b6826dc | 2026-01-04T15:47:42.000902Z | false |
neon-bindings/neon | https://github.com/neon-bindings/neon/blob/22098e4d9f1c4b29447671298bc839476b6826dc/crates/neon/src/event/task.rs | 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 c... | rust | Apache-2.0 | 22098e4d9f1c4b29447671298bc839476b6826dc | 2026-01-04T15:47:42.000902Z | false |
neon-bindings/neon | https://github.com/neon-bindings/neon/blob/22098e4d9f1c4b29447671298bc839476b6826dc/crates/neon/src/event/channel.rs | 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::p... | rust | Apache-2.0 | 22098e4d9f1c4b29447671298bc839476b6826dc | 2026-01-04T15:47:42.000902Z | false |
neon-bindings/neon | https://github.com/neon-bindings/neon/blob/22098e4d9f1c4b29447671298bc839476b6826dc/crates/neon/src/executor/mod.rs | 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 ... | rust | Apache-2.0 | 22098e4d9f1c4b29447671298bc839476b6826dc | 2026-01-04T15:47:42.000902Z | false |
neon-bindings/neon | https://github.com/neon-bindings/neon/blob/22098e4d9f1c4b29447671298bc839476b6826dc/crates/neon/src/executor/tokio.rs | 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 Runti... | rust | Apache-2.0 | 22098e4d9f1c4b29447671298bc839476b6826dc | 2026-01-04T15:47:42.000902Z | false |
neon-bindings/neon | https://github.com/neon-bindings/neon/blob/22098e4d9f1c4b29447671298bc839476b6826dc/crates/neon/src/sys/reference.rs | crates/neon/src/sys/reference.rs | use std::mem::MaybeUninit;
use super::{
bindings as napi,
raw::{Env, Local},
};
pub unsafe fn new(env: Env, value: Local) -> napi::Ref {
let mut result = MaybeUninit::uninit();
napi::create_reference(env, value, 1, result.as_mut_ptr()).unwrap();
result.assume_init()
}
/// # Safety
/// Must only... | rust | Apache-2.0 | 22098e4d9f1c4b29447671298bc839476b6826dc | 2026-01-04T15:47:42.000902Z | false |
neon-bindings/neon | https://github.com/neon-bindings/neon/blob/22098e4d9f1c4b29447671298bc839476b6826dc/crates/neon/src/sys/external.rs | crates/neon/src/sys/external.rs | use std::mem::MaybeUninit;
use super::{
bindings as napi,
debug_send_wrapper::DebugSendWrapper,
raw::{Env, Local},
};
/// `finalize_external` is invoked immediately before a `napi_external` is garbage collected
extern "C" fn finalize_external<T: 'static>(
env: Env,
// Raw pointer to a `Box<T>` sto... | rust | Apache-2.0 | 22098e4d9f1c4b29447671298bc839476b6826dc | 2026-01-04T15:47:42.000902Z | false |
neon-bindings/neon | https://github.com/neon-bindings/neon/blob/22098e4d9f1c4b29447671298bc839476b6826dc/crates/neon/src/sys/promise.rs | crates/neon/src/sys/promise.rs | //! JavaScript Promise and Deferred handle
//!
//! See: [Promises in Node-API](https://nodejs.org/api/n-api.html#n_api_promises)
use std::mem::MaybeUninit;
use super::{bindings as napi, raw::Env};
/// Create a `Promise` and a `napi::Deferred` handle for resolving it
///
/// # Safety
/// * `env` is a valid `napi_env`... | rust | Apache-2.0 | 22098e4d9f1c4b29447671298bc839476b6826dc | 2026-01-04T15:47:42.000902Z | false |
neon-bindings/neon | https://github.com/neon-bindings/neon/blob/22098e4d9f1c4b29447671298bc839476b6826dc/crates/neon/src/sys/array.rs | crates/neon/src/sys/array.rs | //! Facilities for working with Array `napi_value`s.
use super::{
bindings as napi,
raw::{Env, Local},
};
pub unsafe fn new(out: &mut Local, env: Env, length: usize) {
napi::create_array_with_length(env, length, out as *mut _).unwrap();
}
/// Gets the length of a `napi_value` containing a JavaScript Arra... | rust | Apache-2.0 | 22098e4d9f1c4b29447671298bc839476b6826dc | 2026-01-04T15:47:42.000902Z | false |
neon-bindings/neon | https://github.com/neon-bindings/neon/blob/22098e4d9f1c4b29447671298bc839476b6826dc/crates/neon/src/sys/async_work.rs | crates/neon/src/sys/async_work.rs | //! Rust wrappers for Node-API simple asynchronous operations
//!
//! Unlike `napi_async_work` which threads a single mutable pointer to a data
//! struct to both the `execute` and `complete` callbacks, the wrapper follows
//! a more idiomatic Rust ownership pattern by passing the output of `execute`
//! into the input... | rust | Apache-2.0 | 22098e4d9f1c4b29447671298bc839476b6826dc | 2026-01-04T15:47:42.000902Z | false |
neon-bindings/neon | https://github.com/neon-bindings/neon/blob/22098e4d9f1c4b29447671298bc839476b6826dc/crates/neon/src/sys/tsfn.rs | crates/neon/src/sys/tsfn.rs | //! Idiomatic Rust wrappers for N-API threadsafe functions
use std::{
ffi::c_void,
mem::MaybeUninit,
ptr,
sync::{Arc, Mutex},
};
use super::{bindings as napi, no_panic::FailureBoundary, raw::Env};
const BOUNDARY: FailureBoundary = FailureBoundary {
both: "A panic and exception occurred while exec... | rust | Apache-2.0 | 22098e4d9f1c4b29447671298bc839476b6826dc | 2026-01-04T15:47:42.000902Z | false |
neon-bindings/neon | https://github.com/neon-bindings/neon/blob/22098e4d9f1c4b29447671298bc839476b6826dc/crates/neon/src/sys/object.rs | crates/neon/src/sys/object.rs | use std::mem::MaybeUninit;
use super::{
bindings as napi,
raw::{Env, Local},
};
/// Mutates the `out` argument to refer to a `napi_value` containing a newly created JavaScript Object.
pub unsafe fn new(out: &mut Local, env: Env) {
napi::create_object(env, out as *mut _).unwrap();
}
#[cfg(feature = "napi-... | rust | Apache-2.0 | 22098e4d9f1c4b29447671298bc839476b6826dc | 2026-01-04T15:47:42.000902Z | false |
neon-bindings/neon | https://github.com/neon-bindings/neon/blob/22098e4d9f1c4b29447671298bc839476b6826dc/crates/neon/src/sys/date.rs | crates/neon/src/sys/date.rs | use std::mem::MaybeUninit;
use super::{
bindings as napi,
raw::{Env, Local},
};
/// Create a new date object
///
/// # Safety
///
/// `env` is a raw pointer. Please ensure it points to a napi_env that is valid for the current context.
pub unsafe fn new_date(env: Env, value: f64) -> Local {
let mut local =... | rust | Apache-2.0 | 22098e4d9f1c4b29447671298bc839476b6826dc | 2026-01-04T15:47:42.000902Z | false |
neon-bindings/neon | https://github.com/neon-bindings/neon/blob/22098e4d9f1c4b29447671298bc839476b6826dc/crates/neon/src/sys/arraybuffer.rs | crates/neon/src/sys/arraybuffer.rs | #[cfg(feature = "external-buffers")]
use std::os::raw::c_void;
use std::{mem::MaybeUninit, ptr::null_mut, slice};
use super::{
bindings as napi,
raw::{Env, Local},
};
pub unsafe fn new(env: Env, len: usize) -> Result<Local, napi::Status> {
let mut buf = MaybeUninit::uninit();
let status = napi::create... | rust | Apache-2.0 | 22098e4d9f1c4b29447671298bc839476b6826dc | 2026-01-04T15:47:42.000902Z | false |
neon-bindings/neon | https://github.com/neon-bindings/neon/blob/22098e4d9f1c4b29447671298bc839476b6826dc/crates/neon/src/sys/convert.rs | crates/neon/src/sys/convert.rs | use super::{
bindings as napi,
raw::{Env, Local},
};
pub unsafe fn to_string(out: &mut Local, env: Env, value: Local) -> bool {
let status = napi::coerce_to_string(env, value, out as *mut _);
status.is_ok()
}
| rust | Apache-2.0 | 22098e4d9f1c4b29447671298bc839476b6826dc | 2026-01-04T15:47:42.000902Z | false |
neon-bindings/neon | https://github.com/neon-bindings/neon/blob/22098e4d9f1c4b29447671298bc839476b6826dc/crates/neon/src/sys/call.rs | crates/neon/src/sys/call.rs | use std::{mem::MaybeUninit, ptr::null_mut};
use smallvec::SmallVec;
use super::{
bindings as napi,
raw::{Env, FunctionCallbackInfo, Local},
};
// Number of arguments to allocate on the stack. This should be large enough
// to cover most use cases without being wasteful.
//
// * If the number is too large, to... | rust | Apache-2.0 | 22098e4d9f1c4b29447671298bc839476b6826dc | 2026-01-04T15:47:42.000902Z | false |
neon-bindings/neon | https://github.com/neon-bindings/neon/blob/22098e4d9f1c4b29447671298bc839476b6826dc/crates/neon/src/sys/string.rs | crates/neon/src/sys/string.rs | use std::{mem::MaybeUninit, ptr};
use super::{
bindings as napi,
raw::{Env, Local},
};
pub unsafe fn new(out: &mut Local, env: Env, data: *const u8, len: i32) -> bool {
let status = napi::create_string_utf8(env, data as *const _, len as usize, out);
status.is_ok()
}
pub unsafe fn utf8_len(env: Env, ... | rust | Apache-2.0 | 22098e4d9f1c4b29447671298bc839476b6826dc | 2026-01-04T15:47:42.000902Z | false |
neon-bindings/neon | https://github.com/neon-bindings/neon/blob/22098e4d9f1c4b29447671298bc839476b6826dc/crates/neon/src/sys/fun.rs | crates/neon/src/sys/fun.rs | //! Facilities for working with JS functions.
use std::{mem::MaybeUninit, os::raw::c_void, ptr};
use super::{
bindings as napi,
raw::{Env, Local},
};
pub unsafe fn new<F>(env: Env, name: &str, callback: F) -> Result<Local, napi::Status>
where
F: Fn(Env, napi::CallbackInfo) -> Local + 'static,
{
let m... | rust | Apache-2.0 | 22098e4d9f1c4b29447671298bc839476b6826dc | 2026-01-04T15:47:42.000902Z | false |
neon-bindings/neon | https://github.com/neon-bindings/neon/blob/22098e4d9f1c4b29447671298bc839476b6826dc/crates/neon/src/sys/lifecycle.rs | crates/neon/src/sys/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]... | rust | Apache-2.0 | 22098e4d9f1c4b29447671298bc839476b6826dc | 2026-01-04T15:47:42.000902Z | false |
neon-bindings/neon | https://github.com/neon-bindings/neon/blob/22098e4d9f1c4b29447671298bc839476b6826dc/crates/neon/src/sys/typedarray.rs | crates/neon/src/sys/typedarray.rs | use std::{ffi::c_void, mem::MaybeUninit};
use super::{
bindings::{self as napi, TypedArrayType},
raw::{Env, Local},
};
#[derive(Debug)]
/// Information describing a JavaScript [`TypedArray`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/TypedArray)
pub struct TypedArrayInfo ... | rust | Apache-2.0 | 22098e4d9f1c4b29447671298bc839476b6826dc | 2026-01-04T15:47:42.000902Z | false |
neon-bindings/neon | https://github.com/neon-bindings/neon/blob/22098e4d9f1c4b29447671298bc839476b6826dc/crates/neon/src/sys/error.rs | crates/neon/src/sys/error.rs | use std::{mem::MaybeUninit, panic::Location, ptr};
use super::{
bindings as napi,
raw::{Env, Local},
};
pub unsafe fn is_throwing(env: Env) -> bool {
let mut b: MaybeUninit<bool> = MaybeUninit::zeroed();
napi::is_exception_pending(env, b.as_mut_ptr()).unwrap();
b.assume_init()
}
pub unsafe fn c... | rust | Apache-2.0 | 22098e4d9f1c4b29447671298bc839476b6826dc | 2026-01-04T15:47:42.000902Z | false |
neon-bindings/neon | https://github.com/neon-bindings/neon/blob/22098e4d9f1c4b29447671298bc839476b6826dc/crates/neon/src/sys/debug_send_wrapper.rs | crates/neon/src/sys/debug_send_wrapper.rs | //! Wrapper that ensures types are always used from the same thread
//! in debug builds. It is a zero-cost in release builds.
pub(super) use wrapper::DebugSendWrapper;
#[cfg(debug_assertions)]
mod wrapper {
use std::ops::Deref;
#[repr(transparent)]
pub struct DebugSendWrapper<T>(send_wrapper::SendWrapper... | rust | Apache-2.0 | 22098e4d9f1c4b29447671298bc839476b6826dc | 2026-01-04T15:47:42.000902Z | false |
neon-bindings/neon | https://github.com/neon-bindings/neon/blob/22098e4d9f1c4b29447671298bc839476b6826dc/crates/neon/src/sys/scope.rs | crates/neon/src/sys/scope.rs | use std::mem::MaybeUninit;
use super::{
bindings as napi,
raw::{Env, Local},
};
pub(crate) struct HandleScope {
env: Env,
scope: napi::HandleScope,
}
impl HandleScope {
pub(crate) unsafe fn new(env: Env) -> Self {
let mut scope = MaybeUninit::uninit();
napi::open_handle_scope(env... | rust | Apache-2.0 | 22098e4d9f1c4b29447671298bc839476b6826dc | 2026-01-04T15:47:42.000902Z | false |
neon-bindings/neon | https://github.com/neon-bindings/neon/blob/22098e4d9f1c4b29447671298bc839476b6826dc/crates/neon/src/sys/primitive.rs | crates/neon/src/sys/primitive.rs | use super::{
bindings as napi,
raw::{Env, Local},
};
/// Mutates the `out` argument provided to refer to the global `undefined` object.
pub unsafe fn undefined(out: &mut Local, env: Env) {
napi::get_undefined(env, out as *mut Local).unwrap();
}
/// Mutates the `out` argument provided to refer to the globa... | rust | Apache-2.0 | 22098e4d9f1c4b29447671298bc839476b6826dc | 2026-01-04T15:47:42.000902Z | false |
neon-bindings/neon | https://github.com/neon-bindings/neon/blob/22098e4d9f1c4b29447671298bc839476b6826dc/crates/neon/src/sys/raw.rs | crates/neon/src/sys/raw.rs | use super::bindings as napi;
pub type Local = napi::Value;
pub type FunctionCallbackInfo = napi::CallbackInfo;
pub type Env = napi::Env;
| rust | Apache-2.0 | 22098e4d9f1c4b29447671298bc839476b6826dc | 2026-01-04T15:47:42.000902Z | false |
neon-bindings/neon | https://github.com/neon-bindings/neon/blob/22098e4d9f1c4b29447671298bc839476b6826dc/crates/neon/src/sys/no_panic.rs | crates/neon/src/sys/no_panic.rs | //! Utilities that _will_ not panic for use in contexts where unwinding would be
//! undefined behavior.
//!
//! The following helpers do not panic and instead use `napi_fatal_error`
//! to crash the process in a controlled way, making them safe for use in FFI
//! callbacks.
//!
//! `#[track_caller]` is used on these h... | rust | Apache-2.0 | 22098e4d9f1c4b29447671298bc839476b6826dc | 2026-01-04T15:47:42.000902Z | false |
neon-bindings/neon | https://github.com/neon-bindings/neon/blob/22098e4d9f1c4b29447671298bc839476b6826dc/crates/neon/src/sys/mod.rs | crates/neon/src/sys/mod.rs | //! Raw bindings to [Node-API][node-api]
//!
//! [Node-API][node-api] is Node.js's API for building native addons. Neon is
//! predominantly a safe wrapper for Node-API and most users should prefer the
//! the high level abstractions [outside](crate) of the sys module.
//!
//! However, directly using Node-API can be a ... | rust | Apache-2.0 | 22098e4d9f1c4b29447671298bc839476b6826dc | 2026-01-04T15:47:42.000902Z | false |
neon-bindings/neon | https://github.com/neon-bindings/neon/blob/22098e4d9f1c4b29447671298bc839476b6826dc/crates/neon/src/sys/mem.rs | crates/neon/src/sys/mem.rs | use super::{
bindings as napi,
raw::{Env, Local},
};
pub unsafe fn strict_equals(env: Env, lhs: Local, rhs: Local) -> bool {
let mut result = false;
napi::strict_equals(env, lhs, rhs, &mut result as *mut _).unwrap();
result
}
| rust | Apache-2.0 | 22098e4d9f1c4b29447671298bc839476b6826dc | 2026-01-04T15:47:42.000902Z | false |
neon-bindings/neon | https://github.com/neon-bindings/neon/blob/22098e4d9f1c4b29447671298bc839476b6826dc/crates/neon/src/sys/buffer.rs | crates/neon/src/sys/buffer.rs | #[cfg(feature = "external-buffers")]
use std::os::raw::c_void;
use std::{mem::MaybeUninit, slice};
use super::{
bindings as napi,
raw::{Env, Local},
};
pub unsafe fn new(env: Env, len: usize) -> Result<Local, napi::Status> {
let (buf, bytes) = uninitialized(env, len)?;
std::ptr::write_bytes(bytes, 0,... | rust | Apache-2.0 | 22098e4d9f1c4b29447671298bc839476b6826dc | 2026-01-04T15:47:42.000902Z | false |
neon-bindings/neon | https://github.com/neon-bindings/neon/blob/22098e4d9f1c4b29447671298bc839476b6826dc/crates/neon/src/sys/tag.rs | crates/neon/src/sys/tag.rs | use super::{
bindings as napi,
raw::{Env, Local},
};
/// Return true if an `napi_value` `val` has the expected value type.
unsafe fn is_type(env: Env, val: Local, expect: napi::ValueType) -> bool {
let mut actual = napi::ValueType::Undefined;
napi::typeof_value(env, val, &mut actual as *mut _).unwrap()... | rust | Apache-2.0 | 22098e4d9f1c4b29447671298bc839476b6826dc | 2026-01-04T15:47:42.000902Z | false |
neon-bindings/neon | https://github.com/neon-bindings/neon/blob/22098e4d9f1c4b29447671298bc839476b6826dc/crates/neon/src/sys/bindings/functions.rs | crates/neon/src/sys/bindings/functions.rs | #![allow(clippy::too_many_arguments)]
mod napi1 {
use super::super::types::*;
use std::os::raw::{c_char, c_void};
generate!(
#[cfg_attr(docsrs, doc(cfg(feature = "napi-1")))]
extern "C" {
fn get_undefined(env: Env, result: *mut Value) -> Status;
fn get_null(env: En... | rust | Apache-2.0 | 22098e4d9f1c4b29447671298bc839476b6826dc | 2026-01-04T15:47:42.000902Z | false |
neon-bindings/neon | https://github.com/neon-bindings/neon/blob/22098e4d9f1c4b29447671298bc839476b6826dc/crates/neon/src/sys/bindings/types.rs | crates/neon/src/sys/bindings/types.rs | use std::ffi::c_void;
#[repr(C)]
#[derive(Debug, Copy, Clone)]
#[doc(hidden)]
pub struct Env__ {
_unused: [u8; 0],
}
#[cfg_attr(docsrs, doc(cfg(feature = "napi-1")))]
/// [`napi_env`](https://nodejs.org/api/n-api.html#napi_env)
pub type Env = *mut Env__;
#[repr(C)]
#[derive(Debug, Copy, Clone)]
#[doc(hidden)]
pu... | rust | Apache-2.0 | 22098e4d9f1c4b29447671298bc839476b6826dc | 2026-01-04T15:47:42.000902Z | false |
neon-bindings/neon | https://github.com/neon-bindings/neon/blob/22098e4d9f1c4b29447671298bc839476b6826dc/crates/neon/src/sys/bindings/mod.rs | crates/neon/src/sys/bindings/mod.rs | //! # FFI bindings to Node-API symbols
//!
//! Rust types generated from [Node-API](https://nodejs.org/api/n-api.html).
// These types are manually copied from bindings generated from `bindgen`. To
// update, use the following approach:
//
// * Run a debug build of Neon at least once to install `nodejs-sys`
// * Open ... | rust | Apache-2.0 | 22098e4d9f1c4b29447671298bc839476b6826dc | 2026-01-04T15:47:42.000902Z | false |
neon-bindings/neon | https://github.com/neon-bindings/neon/blob/22098e4d9f1c4b29447671298bc839476b6826dc/crates/neon/src/context/internal.rs | 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 ... | rust | Apache-2.0 | 22098e4d9f1c4b29447671298bc839476b6826dc | 2026-01-04T15:47:42.000902Z | false |
neon-bindings/neon | https://github.com/neon-bindings/neon/blob/22098e4d9f1c4b29447671298bc839476b6826dc/crates/neon/src/context/mod.rs | 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 ... | rust | Apache-2.0 | 22098e4d9f1c4b29447671298bc839476b6826dc | 2026-01-04T15:47:42.000902Z | false |
neon-bindings/neon | https://github.com/neon-bindings/neon/blob/22098e4d9f1c4b29447671298bc839476b6826dc/crates/neon/src/types_impl/promise.rs | crates/neon/src/types_impl/promise.rs | use std::ptr;
use crate::{
context::{
internal::{ContextInternal, Env},
Context, Cx,
},
handle::{internal::TransparentNoCopyWrapper, Handle},
object::Object,
result::JsResult,
sys::{self, no_panic::FailureBoundary, raw},
types::{private::ValueInternal, Value},
};
#[cfg(feat... | rust | Apache-2.0 | 22098e4d9f1c4b29447671298bc839476b6826dc | 2026-01-04T15:47:42.000902Z | false |
neon-bindings/neon | https://github.com/neon-bindings/neon/blob/22098e4d9f1c4b29447671298bc839476b6826dc/crates/neon/src/types_impl/date.rs | crates/neon/src/types_impl/date.rs | use std::{
error::Error,
fmt::{self, Debug},
};
use super::{private::ValueInternal, Value};
use crate::{
context::{
internal::{ContextInternal, Env},
Context, Cx,
},
handle::{internal::TransparentNoCopyWrapper, Handle},
object::Object,
result::{JsResult, ResultExt},
sys... | rust | Apache-2.0 | 22098e4d9f1c4b29447671298bc839476b6826dc | 2026-01-04T15:47:42.000902Z | false |
neon-bindings/neon | https://github.com/neon-bindings/neon/blob/22098e4d9f1c4b29447671298bc839476b6826dc/crates/neon/src/types_impl/bigint.rs | crates/neon/src/types_impl/bigint.rs | //! Types for working with [`JsBigInt`].
use std::{error, fmt, mem::MaybeUninit};
use crate::{
context::{
internal::{ContextInternal, Env},
Context, Cx,
},
handle::{internal::TransparentNoCopyWrapper, Handle},
result::{NeonResult, ResultExt},
sys::{self, raw},
types::{private, ... | rust | Apache-2.0 | 22098e4d9f1c4b29447671298bc839476b6826dc | 2026-01-04T15:47:42.000902Z | false |
neon-bindings/neon | https://github.com/neon-bindings/neon/blob/22098e4d9f1c4b29447671298bc839476b6826dc/crates/neon/src/types_impl/error.rs | crates/neon/src/types_impl/error.rs | //! Types and traits representing JavaScript error values.
use std::panic::{catch_unwind, UnwindSafe};
use crate::{
context::{
internal::{ContextInternal, Env},
Context, Cx,
},
handle::{internal::TransparentNoCopyWrapper, Handle},
object::Object,
result::{NeonResult, Throw},
sy... | rust | Apache-2.0 | 22098e4d9f1c4b29447671298bc839476b6826dc | 2026-01-04T15:47:42.000902Z | false |
neon-bindings/neon | https://github.com/neon-bindings/neon/blob/22098e4d9f1c4b29447671298bc839476b6826dc/crates/neon/src/types_impl/mod.rs | crates/neon/src/types_impl/mod.rs | // See types_docs.rs for top-level module API docs.
#[cfg(feature = "napi-6")]
#[cfg_attr(docsrs, doc(cfg(feature = "napi-6")))]
pub mod bigint;
pub(crate) mod boxed;
pub mod buffer;
#[cfg(feature = "napi-5")]
pub(crate) mod date;
pub(crate) mod error;
pub mod extract;
pub mod function;
pub(crate) mod promise;
pub(cr... | rust | Apache-2.0 | 22098e4d9f1c4b29447671298bc839476b6826dc | 2026-01-04T15:47:42.000902Z | true |
neon-bindings/neon | https://github.com/neon-bindings/neon/blob/22098e4d9f1c4b29447671298bc839476b6826dc/crates/neon/src/types_impl/boxed.rs | crates/neon/src/types_impl/boxed.rs | use std::{
any::{self, Any},
ops::Deref,
};
use crate::{
context::{
internal::{ContextInternal, Env},
Context, Cx,
},
handle::{internal::TransparentNoCopyWrapper, Handle},
object::Object,
sys::{external, raw},
types::{boxed::private::JsBoxInner, private::ValueInternal, V... | rust | Apache-2.0 | 22098e4d9f1c4b29447671298bc839476b6826dc | 2026-01-04T15:47:42.000902Z | false |
neon-bindings/neon | https://github.com/neon-bindings/neon/blob/22098e4d9f1c4b29447671298bc839476b6826dc/crates/neon/src/types_impl/private.rs | crates/neon/src/types_impl/private.rs | use std::{ffi::c_void, mem::MaybeUninit};
use crate::{
context::{
internal::{ContextInternal, Env},
Context, Cx,
},
handle::{internal::TransparentNoCopyWrapper, Handle},
result::{JsResult, NeonResult, Throw},
sys::{self, bindings as napi, raw},
types::Value,
};
use super::JsVal... | rust | Apache-2.0 | 22098e4d9f1c4b29447671298bc839476b6826dc | 2026-01-04T15:47:42.000902Z | false |
neon-bindings/neon | https://github.com/neon-bindings/neon/blob/22098e4d9f1c4b29447671298bc839476b6826dc/crates/neon/src/types_impl/utf8.rs | crates/neon/src/types_impl/utf8.rs | use std::borrow::Cow;
const SMALL_MAX: usize = i32::MAX as usize;
/// V8 APIs that take UTF-8 strings take their length in the form of 32-bit
/// signed integers. This type represents a UTF-8 string that contains no
/// more than `i32::MAX` bytes of code units.
pub struct SmallUtf8<'a> {
contents: Cow<'a, str>,
}... | rust | Apache-2.0 | 22098e4d9f1c4b29447671298bc839476b6826dc | 2026-01-04T15:47:42.000902Z | false |
neon-bindings/neon | https://github.com/neon-bindings/neon/blob/22098e4d9f1c4b29447671298bc839476b6826dc/crates/neon/src/types_impl/extract/with.rs | crates/neon/src/types_impl/extract/with.rs | use crate::{
context::Cx,
result::JsResult,
types::{extract::TryIntoJs, Value},
};
struct With<F>(pub F);
/// Wraps a closure that will be lazily evaluated when [`TryIntoJs::try_into_js`] is
/// called.
///
/// Useful for executing arbitrary code on the main thread before returning from a
/// function exp... | rust | Apache-2.0 | 22098e4d9f1c4b29447671298bc839476b6826dc | 2026-01-04T15:47:42.000902Z | false |
neon-bindings/neon | https://github.com/neon-bindings/neon/blob/22098e4d9f1c4b29447671298bc839476b6826dc/crates/neon/src/types_impl/extract/try_from_js.rs | crates/neon/src/types_impl/extract/try_from_js.rs | // Implementations in this file are equivalent to a call to `.downcast()` and
// `.value(&mut cx)`. These specialized versions provide a performance benefit
// because they can combine two Node-API calls into a single call that both
// gets the value and checks the type at the same time.
use std::{convert::Infallible,... | rust | Apache-2.0 | 22098e4d9f1c4b29447671298bc839476b6826dc | 2026-01-04T15:47:42.000902Z | false |
neon-bindings/neon | https://github.com/neon-bindings/neon/blob/22098e4d9f1c4b29447671298bc839476b6826dc/crates/neon/src/types_impl/extract/container.rs | crates/neon/src/types_impl/extract/container.rs | use std::{
cell::{Ref, RefCell, RefMut},
rc::Rc,
sync::{Arc, LazyLock},
};
use crate::{
context::{Context, Cx},
handle::Handle,
result::{JsResult, NeonResult},
types::{
extract::{TryFromJs, TryIntoJs},
JsBox, JsValue, Value,
},
};
use super::error::TypeExpected;
impl<'... | rust | Apache-2.0 | 22098e4d9f1c4b29447671298bc839476b6826dc | 2026-01-04T15:47:42.000902Z | false |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.