Struct deno_runtime::worker::MainWorker
source · [−]pub struct MainWorker {
pub js_runtime: JsRuntime,
/* private fields */
}
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
sourceimpl MainWorker
impl MainWorker
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 fn bootstrap(&mut self, options: &BootstrapOptions)
sourcepub fn execute_script(
&mut self,
script_name: &str,
source_code: &str
) -> Result<(), AnyError>
pub fn execute_script(
&mut self,
script_name: &str,
source_code: &str
) -> Result<(), AnyError>
sourcepub 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.
sourcepub async fn evaluate_module(&mut self, id: ModuleId) -> Result<(), AnyError>
pub async fn evaluate_module(&mut self, id: ModuleId) -> Result<(), AnyError>
Executes specified JavaScript module.
sourcepub 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.
sourcepub 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.
sourcepub async fn create_inspector_session(&mut self) -> LocalInspectorSession
pub async fn create_inspector_session(&mut self) -> LocalInspectorSession
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 run_event_loop(
&mut self,
wait_for_inspector: bool
) -> Result<(), AnyError>
sourcepub 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.
sourcepub fn get_exit_code(&self) -> i32
pub fn get_exit_code(&self) -> i32
Return exit code set by the executed code (either in main worker or one of child web workers).
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
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
sourceimpl<T> Instrument for T
impl<T> Instrument for T
sourcefn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
sourcefn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
impl<V, T> VZip<V> for T where
V: MultiLane<T>,
impl<V, T> VZip<V> for T where
V: MultiLane<T>,
fn vzip(self) -> V
sourceimpl<T> WithSubscriber for T
impl<T> WithSubscriber for T
sourcefn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self> where
S: Into<Dispatch>,
fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self> where
S: Into<Dispatch>,
Attaches the provided Subscriber
to this type, returning a
WithDispatch
wrapper. Read more
sourcefn with_current_subscriber(self) -> WithDispatch<Self>
fn with_current_subscriber(self) -> WithDispatch<Self>
Attaches the current default Subscriber
to this type, returning a
WithDispatch
wrapper. Read more