Struct napi::AsyncWorkPromise

source ·
pub struct AsyncWorkPromise { /* private fields */ }

Implementations§

Examples found in repository?
src/bindgen_runtime/js_values/task.rs (line 149)
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
  unsafe fn to_napi_value(env: sys::napi_env, val: Self) -> crate::Result<sys::napi_value> {
    if let Some(abort_controller) = val.abort_signal {
      let async_promise = async_work::run(env, val.inner, Some(abort_controller.status.clone()))?;
      abort_controller
        .raw_work
        .store(async_promise.napi_async_work, Ordering::Relaxed);
      abort_controller
        .raw_deferred
        .store(async_promise.deferred, Ordering::Relaxed);
      Ok(async_promise.promise_object().0.value)
    } else {
      let async_promise = async_work::run(env, val.inner, None)?;
      Ok(async_promise.promise_object().0.value)
    }
  }

Auto Trait Implementations§

Blanket Implementations§

Gets the TypeId of self. Read more
Immutably borrows from an owned value. Read more
Mutably borrows from an owned value. Read more

Returns the argument unchanged.

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

The type returned in the event of a conversion error.
Performs the conversion.
The type returned in the event of a conversion error.
Performs the conversion.