Struct mozjs::jsapi::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 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