neon::result

Trait ResultExt

Source
pub trait ResultExt<T> {
    // Required method
    fn or_throw<'a, C: Context<'a>>(self, cx: &mut C) -> NeonResult<T>;
}
Expand description

Extension trait for converting Rust Result values into NeonResult values by throwing JavaScript exceptions.

Required Methods§

Source

fn or_throw<'a, C: Context<'a>>(self, cx: &mut C) -> NeonResult<T>

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.

Implementations on Foreign Types§

Source§

impl<'a, 'b, T, E> ResultExt<Handle<'a, T>> for Result<Handle<'a, T>, Handle<'b, E>>
where T: Value, E: Value,

Source§

fn or_throw<'cx, C: Context<'cx>>(self, cx: &mut C) -> JsResult<'a, T>

Source§

impl<'a, T: Value> ResultExt<Handle<'a, T>> for Result<Handle<'a, T>, DateError>

Source§

fn or_throw<'b, C: Context<'b>>(self, cx: &mut C) -> JsResult<'a, T>

Creates an Error on error

Source§

impl<T> ResultExt<T> for Result<T, JoinError>

Source§

fn or_throw<'a, C: Context<'a>>(self, cx: &mut C) -> NeonResult<T>

Source§

impl<T> ResultExt<T> for Result<T, BorrowError>

Source§

fn or_throw<'a, C: Context<'a>>(self, cx: &mut C) -> NeonResult<T>

Source§

impl<T, E> ResultExt<T> for Result<T, RangeError<E>>
where E: Display,

Available on crate feature napi-6 only.
Source§

fn or_throw<'a, C: Context<'a>>(self, cx: &mut C) -> NeonResult<T>

Implementors§

Source§

impl<'a> ResultExt<Handle<'a, JsString>> for StringResult<'a>

Source§

impl<'a, F: Value, T: Value> ResultExt<Handle<'a, T>> for DowncastResult<'a, F, T>