#1026·neon

Unseal `TryFromJs` trait

Author: kjvalencikCreated Apr 1, 2024Updated Jun 8, 2026

The neon::extract::TryFromJs trait was introduced in https://github.com/neon-bindings/neon/pull/1024 as standardized and ergonomic way of extract Rust values from JavaScript.

Allowing users to implement TryFromJs gives the power of cx.args() and automatic conversions in export macros to user defined types.

Questions to answer prior to stabilization:

  • Should there be a trait bound on the Error type (e.g., TryIntoJs or Result<Self, Self::Error>: ResultExt)?
  • Should there be a default implementation for from_js?