Struct boa_engine::module::SyntheticModuleInitializer
source · pub struct SyntheticModuleInitializer { /* private fields */ }
Expand description
The initializing steps of a SyntheticModule
.
§Caveats
By limitations of the Rust language, the garbage collector currently cannot inspect closures
in order to trace their captured variables. This means that only Copy
closures are 100% safe
to use. All other closures can also be stored in a NativeFunction
, albeit by using an unsafe
API, but note that passing closures implicitly capturing traceable types could cause
Undefined Behaviour.
Implementations§
source§impl SyntheticModuleInitializer
impl SyntheticModuleInitializer
sourcepub fn from_copy_closure<F>(closure: F) -> Self
pub fn from_copy_closure<F>(closure: F) -> Self
Creates a SyntheticModuleInitializer
from a Copy
closure.
sourcepub fn from_copy_closure_with_captures<F, T>(closure: F, captures: T) -> Self
pub fn from_copy_closure_with_captures<F, T>(closure: F, captures: T) -> Self
Creates a SyntheticModuleInitializer
from a Copy
closure and a list of traceable captures.
sourcepub unsafe fn from_closure<F>(closure: F) -> Self
pub unsafe fn from_closure<F>(closure: F) -> Self
Creates a new SyntheticModuleInitializer
from a closure.
§Safety
Passing a closure that contains a captured variable that needs to be traced by the garbage collector could cause an use after free, memory corruption or other kinds of Undefined Behaviour. See https://github.com/Manishearth/rust-gc/issues/50 for a technical explanation on why that is the case.
sourcepub unsafe fn from_closure_with_captures<F, T>(closure: F, captures: T) -> Self
pub unsafe fn from_closure_with_captures<F, T>(closure: F, captures: T) -> Self
Create a new SyntheticModuleInitializer
from a closure and a list of traceable captures.
§Safety
Passing a closure that contains a captured variable that needs to be traced by the garbage collector could cause an use after free, memory corruption or other kinds of Undefined Behaviour. See https://github.com/Manishearth/rust-gc/issues/50 for a technical explanation on why that is the case.
Trait Implementations§
source§impl Clone for SyntheticModuleInitializer
impl Clone for SyntheticModuleInitializer
source§fn clone(&self) -> SyntheticModuleInitializer
fn clone(&self) -> SyntheticModuleInitializer
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read moresource§impl Debug for SyntheticModuleInitializer
impl Debug for SyntheticModuleInitializer
source§impl Drop for SyntheticModuleInitializer
impl Drop for SyntheticModuleInitializer
source§impl Trace for SyntheticModuleInitializer
impl Trace for SyntheticModuleInitializer
source§unsafe fn trace_non_roots(&self)
unsafe fn trace_non_roots(&self)
source§fn run_finalizer(&self)
fn run_finalizer(&self)
Finalize::finalize
on this object and all
contained subobjects.Auto Trait Implementations§
impl !RefUnwindSafe for SyntheticModuleInitializer
impl !Send for SyntheticModuleInitializer
impl !Sync for SyntheticModuleInitializer
impl Unpin for SyntheticModuleInitializer
impl !UnwindSafe for SyntheticModuleInitializer
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
source§impl<T> Pipe for Twhere
T: ?Sized,
impl<T> Pipe for Twhere
T: ?Sized,
source§fn pipe<R>(self, func: impl FnOnce(Self) -> R) -> Rwhere
Self: Sized,
fn pipe<R>(self, func: impl FnOnce(Self) -> R) -> Rwhere
Self: Sized,
source§fn pipe_ref<'a, R>(&'a self, func: impl FnOnce(&'a Self) -> R) -> Rwhere
R: 'a,
fn pipe_ref<'a, R>(&'a self, func: impl FnOnce(&'a Self) -> R) -> Rwhere
R: 'a,
self
and passes that borrow into the pipe function. Read moresource§fn pipe_ref_mut<'a, R>(&'a mut self, func: impl FnOnce(&'a mut Self) -> R) -> Rwhere
R: 'a,
fn pipe_ref_mut<'a, R>(&'a mut self, func: impl FnOnce(&'a mut Self) -> R) -> Rwhere
R: 'a,
self
and passes that borrow into the pipe function. Read moresource§fn pipe_borrow<'a, B, R>(&'a self, func: impl FnOnce(&'a B) -> R) -> R
fn pipe_borrow<'a, B, R>(&'a self, func: impl FnOnce(&'a B) -> R) -> R
source§fn pipe_borrow_mut<'a, B, R>(
&'a mut self,
func: impl FnOnce(&'a mut B) -> R
) -> R
fn pipe_borrow_mut<'a, B, R>( &'a mut self, func: impl FnOnce(&'a mut B) -> R ) -> R
source§fn pipe_as_ref<'a, U, R>(&'a self, func: impl FnOnce(&'a U) -> R) -> R
fn pipe_as_ref<'a, U, R>(&'a self, func: impl FnOnce(&'a U) -> R) -> R
self
, then passes self.as_ref()
into the pipe function.source§fn pipe_as_mut<'a, U, R>(&'a mut self, func: impl FnOnce(&'a mut U) -> R) -> R
fn pipe_as_mut<'a, U, R>(&'a mut self, func: impl FnOnce(&'a mut U) -> R) -> R
self
, then passes self.as_mut()
into the pipe
function.source§fn pipe_deref<'a, T, R>(&'a self, func: impl FnOnce(&'a T) -> R) -> R
fn pipe_deref<'a, T, R>(&'a self, func: impl FnOnce(&'a T) -> R) -> R
self
, then passes self.deref()
into the pipe function.source§impl<T> Tap for T
impl<T> Tap for T
source§fn tap_borrow<B>(self, func: impl FnOnce(&B)) -> Self
fn tap_borrow<B>(self, func: impl FnOnce(&B)) -> Self
Borrow<B>
of a value. Read moresource§fn tap_borrow_mut<B>(self, func: impl FnOnce(&mut B)) -> Self
fn tap_borrow_mut<B>(self, func: impl FnOnce(&mut B)) -> Self
BorrowMut<B>
of a value. Read moresource§fn tap_ref<R>(self, func: impl FnOnce(&R)) -> Self
fn tap_ref<R>(self, func: impl FnOnce(&R)) -> Self
AsRef<R>
view of a value. Read moresource§fn tap_ref_mut<R>(self, func: impl FnOnce(&mut R)) -> Self
fn tap_ref_mut<R>(self, func: impl FnOnce(&mut R)) -> Self
AsMut<R>
view of a value. Read moresource§fn tap_deref<T>(self, func: impl FnOnce(&T)) -> Self
fn tap_deref<T>(self, func: impl FnOnce(&T)) -> Self
Deref::Target
of a value. Read moresource§fn tap_deref_mut<T>(self, func: impl FnOnce(&mut T)) -> Self
fn tap_deref_mut<T>(self, func: impl FnOnce(&mut T)) -> Self
Deref::Target
of a value. Read moresource§fn tap_dbg(self, func: impl FnOnce(&Self)) -> Self
fn tap_dbg(self, func: impl FnOnce(&Self)) -> Self
.tap()
only in debug builds, and is erased in release builds.source§fn tap_mut_dbg(self, func: impl FnOnce(&mut Self)) -> Self
fn tap_mut_dbg(self, func: impl FnOnce(&mut Self)) -> Self
.tap_mut()
only in debug builds, and is erased in release
builds.source§fn tap_borrow_dbg<B>(self, func: impl FnOnce(&B)) -> Self
fn tap_borrow_dbg<B>(self, func: impl FnOnce(&B)) -> Self
.tap_borrow()
only in debug builds, and is erased in release
builds.source§fn tap_borrow_mut_dbg<B>(self, func: impl FnOnce(&mut B)) -> Self
fn tap_borrow_mut_dbg<B>(self, func: impl FnOnce(&mut B)) -> Self
.tap_borrow_mut()
only in debug builds, and is erased in release
builds.source§fn tap_ref_dbg<R>(self, func: impl FnOnce(&R)) -> Self
fn tap_ref_dbg<R>(self, func: impl FnOnce(&R)) -> Self
.tap_ref()
only in debug builds, and is erased in release
builds.source§fn tap_ref_mut_dbg<R>(self, func: impl FnOnce(&mut R)) -> Self
fn tap_ref_mut_dbg<R>(self, func: impl FnOnce(&mut R)) -> Self
.tap_ref_mut()
only in debug builds, and is erased in release
builds.source§fn tap_deref_dbg<T>(self, func: impl FnOnce(&T)) -> Self
fn tap_deref_dbg<T>(self, func: impl FnOnce(&T)) -> Self
.tap_deref()
only in debug builds, and is erased in release
builds.