mirror of
https://github.com/napi-rs/napi-rs.git
synced 2025-12-08 19:56:07 +00:00
chore(napi): add UnwindSafe and RefUnwindSafe back to AbortSignal and AsyncWorkPromise (#2789)
This commit is contained in:
parent
1ca2bad43f
commit
16dbf68dca
@ -2,6 +2,7 @@ use std::cell::Cell;
|
||||
use std::marker::PhantomData;
|
||||
use std::mem;
|
||||
use std::os::raw::c_void;
|
||||
use std::panic::UnwindSafe;
|
||||
use std::ptr;
|
||||
use std::rc::Rc;
|
||||
|
||||
@ -31,6 +32,9 @@ pub struct AsyncWorkPromise<T> {
|
||||
_phantom: PhantomData<T>,
|
||||
}
|
||||
|
||||
impl<T> UnwindSafe for AsyncWorkPromise<T> {}
|
||||
impl<T> std::panic::RefUnwindSafe for AsyncWorkPromise<T> {}
|
||||
|
||||
impl<T> AsyncWorkPromise<T> {
|
||||
pub fn promise_object<'env>(&self) -> PromiseRaw<'env, T> {
|
||||
PromiseRaw::new(self.env, self.raw_promise)
|
||||
|
||||
@ -1,8 +1,8 @@
|
||||
use std::cell::Cell;
|
||||
use std::ffi::c_void;
|
||||
use std::marker::PhantomData;
|
||||
use std::ptr;
|
||||
use std::rc::Rc;
|
||||
use std::{cell::Cell, panic::UnwindSafe};
|
||||
|
||||
use crate::{
|
||||
async_work,
|
||||
@ -56,6 +56,9 @@ pub struct AbortSignal {
|
||||
status: Rc<Cell<u8>>,
|
||||
}
|
||||
|
||||
impl UnwindSafe for AbortSignal {}
|
||||
impl std::panic::RefUnwindSafe for AbortSignal {}
|
||||
|
||||
#[repr(transparent)]
|
||||
struct AbortSignalStack(Vec<AbortSignal>);
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user