neon::types

Trait Value

Source
pub trait Value: ValueInternal {
    // Provided methods
    fn to_string<'cx, C: Context<'cx>>(
        &self,
        cx: &mut C,
    ) -> JsResult<'cx, JsString> { ... }
    fn as_value<'cx, C: Context<'cx>>(&self, _: &mut C) -> Handle<'cx, JsValue> { ... }
    fn to_raw(&self) -> Value { ... }
    unsafe fn from_raw<'cx, C: Context<'cx>>(
        cx: &C,
        value: Value,
    ) -> Handle<'cx, Self> { ... }
}
Expand description

The trait shared by all JavaScript values.

Provided Methods§

Source

fn to_string<'cx, C: Context<'cx>>(&self, cx: &mut C) -> JsResult<'cx, JsString>

Source

fn as_value<'cx, C: Context<'cx>>(&self, _: &mut C) -> Handle<'cx, JsValue>

Source

fn to_raw(&self) -> Value

Available on crate feature sys only.

Get a raw reference to the wrapped Node-API value.

Source

unsafe fn from_raw<'cx, C: Context<'cx>>( cx: &C, value: Value, ) -> Handle<'cx, Self>

Available on crate feature sys only.

Creates a value from a raw Node-API value.

§Safety
  • value must be of type Self
  • value must be valid for 'cx

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementors§