Struct mozjs::jsapi::JS::AutoSaveExceptionState
source · #[repr(C)]pub struct AutoSaveExceptionState {
pub context: *mut JSContext,
pub status: ExceptionStatus,
pub exceptionValue: Rooted<Value>,
pub exceptionStack: Rooted<*mut JSObject>,
}
Expand description
Save and later restore the current exception state of a given JSContext. This is useful for implementing behavior in C++ that’s like try/catch or try/finally in JS.
Typical usage:
bool ok = JS::Evaluate(cx, ...);
AutoSaveExceptionState savedExc(cx);
... cleanup that might re-enter JS ...
return ok;
Fields§
§context: *mut JSContext
§status: ExceptionStatus
§exceptionValue: Rooted<Value>
§exceptionStack: Rooted<*mut JSObject>
Auto Trait Implementations§
impl Freeze for AutoSaveExceptionState
impl RefUnwindSafe for AutoSaveExceptionState
impl !Send for AutoSaveExceptionState
impl !Sync for AutoSaveExceptionState
impl Unpin for AutoSaveExceptionState
impl UnwindSafe for AutoSaveExceptionState
Blanket Implementations§
source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
source§impl<T> Filterable for T
impl<T> Filterable for T
source§fn filterable(
self,
filter_name: &'static str,
) -> RequestFilterDataProvider<T, fn(_: DataRequest<'_>) -> bool>
fn filterable( self, filter_name: &'static str, ) -> RequestFilterDataProvider<T, fn(_: DataRequest<'_>) -> bool>
Creates a filterable data provider with the given name for debugging. Read more
source§impl<T> IntoEither for T
impl<T> IntoEither for T
source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self
into a Left
variant of Either<Self, Self>
if into_left
is true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read moresource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self
into a Left
variant of Either<Self, Self>
if into_left(&self)
returns true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read more