Struct deno_runtime::worker::MainWorker
source ·
[−]pub struct MainWorker {
pub js_runtime: JsRuntime,
// some fields omitted
}
Expand description
This worker is created and used by almost all subcommands in Deno executable.
It provides ops available in the Deno
namespace.
All WebWorker
s created during program execution
are descendants of this worker.
Fields
js_runtime: JsRuntime
Implementations
pub fn bootstrap_from_options(
main_module: ModuleSpecifier,
permissions: Permissions,
options: WorkerOptions
) -> Self
pub fn from_options(
main_module: ModuleSpecifier,
permissions: Permissions,
options: WorkerOptions
) -> Self
pub async fn preload_module(
&mut self,
module_specifier: &ModuleSpecifier,
main: bool
) -> Result<ModuleId, AnyError>
pub async fn preload_module(
&mut self,
module_specifier: &ModuleSpecifier,
main: bool
) -> Result<ModuleId, AnyError>
Loads and instantiates specified JavaScript module as “main” or “side” module.
pub async fn execute_side_module(
&mut self,
module_specifier: &ModuleSpecifier
) -> Result<(), AnyError>
pub async fn execute_side_module(
&mut self,
module_specifier: &ModuleSpecifier
) -> Result<(), AnyError>
Loads, instantiates and executes specified JavaScript module.
pub async fn execute_main_module(
&mut self,
module_specifier: &ModuleSpecifier
) -> Result<(), AnyError>
pub async fn execute_main_module(
&mut self,
module_specifier: &ModuleSpecifier
) -> Result<(), AnyError>
Loads, instantiates and executes specified JavaScript module.
This module will have “import.meta.main” equal to true.
Create new inspector session. This function panics if Worker was not configured to create inspector.
pub fn poll_event_loop(
&mut self,
cx: &mut Context<'_>,
wait_for_inspector: bool
) -> Poll<Result<(), AnyError>>
pub async fn with_event_loop<'a, T>(
&mut self,
fut: Pin<Box<dyn Future<Output = T> + 'a>>
) -> T
pub async fn with_event_loop<'a, T>(
&mut self,
fut: Pin<Box<dyn Future<Output = T> + 'a>>
) -> T
A utility function that runs provided future concurrently with the event loop.
Useful when using a local inspector session.
Return exit code set by the executed code (either in main worker or one of child web workers).
Dispatches “load” event to the JavaScript runtime.
Does not poll event loop, and thus not await any of the “load” event handlers.
Auto Trait Implementations
impl !RefUnwindSafe for MainWorker
impl !Send for MainWorker
impl !Sync for MainWorker
impl Unpin for MainWorker
impl !UnwindSafe for MainWorker
Blanket Implementations
Mutably borrows from an owned value. Read more
pub fn vzip(self) -> V
Attaches the provided Subscriber
to this type, returning a
WithDispatch
wrapper. Read more
Attaches the current default Subscriber
to this type, returning a
WithDispatch
wrapper. Read more