pub struct CallbackScope<'s, C = Context> { /* private fields */ }Expand description
A CallbackScope can be used to bootstrap a HandleScope and
ContextScope inside a callback function that gets called by V8.
Bootstrapping a scope inside a callback is the only valid use case of this
type; using it in other places leads to undefined behavior, which is also
the reason CallbackScope::new() is marked as being an unsafe function.
For some callback types, rusty_v8 internally creates a scope and passes it as an argument to to embedder callback. Eventually we intend to wrap all callbacks in this fashion, so the embedder would never needs to construct a CallbackScope.
A CallbackScope<()>, without context, can be created from:
&mut Isolate&mut OwnedIsolate
A CallbackScope, with context, can be created from:
Local<Context>Local<Message>Local<Object>Local<Promise>Local<SharedArrayBuffer>&FunctionCallbackInfo&PropertyCallbackInfo&PromiseRejectMessage&FastApiCallbackOptions
Implementations§
Source§impl<'s> CallbackScope<'s>
impl<'s> CallbackScope<'s>
pub unsafe fn new<P: NewCallbackScope<'s>>( param: P, ) -> ScopeStorage<P::NewScope>
Trait Implementations§
Source§impl<C> AsRef<Isolate> for CallbackScope<'_, C>
impl<C> AsRef<Isolate> for CallbackScope<'_, C>
Source§impl<'s> AsRef<Pin<&'s mut HandleScope<'s, ()>>> for CallbackScope<'s, ()>
impl<'s> AsRef<Pin<&'s mut HandleScope<'s, ()>>> for CallbackScope<'s, ()>
Auto Trait Implementations§
impl<'s, C = Context> !Freeze for CallbackScope<'s, C>
impl<'s, C = Context> !RefUnwindSafe for CallbackScope<'s, C>
impl<'s, C = Context> !Send for CallbackScope<'s, C>
impl<'s, C = Context> !Sync for CallbackScope<'s, C>
impl<'s, C = Context> !Unpin for CallbackScope<'s, C>
impl<'s, C> UnwindSafe for CallbackScope<'s, C>where
C: RefUnwindSafe,
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