Struct deno_runtime::web_worker::WebWorker
source · [−]pub struct WebWorker {
pub js_runtime: JsRuntime,
pub name: String,
pub worker_type: WebWorkerType,
pub main_module: ModuleSpecifier,
/* private fields */
}
Expand description
This struct is an implementation of Worker
Web API
Each WebWorker
is either a child of MainWorker
or other
WebWorker
.
Fields
js_runtime: JsRuntime
name: String
worker_type: WebWorkerType
main_module: ModuleSpecifier
Implementations
sourceimpl WebWorker
impl WebWorker
pub fn bootstrap_from_options(
name: String,
permissions: Permissions,
main_module: ModuleSpecifier,
worker_id: WorkerId,
options: WebWorkerOptions
) -> (Self, SendableWebWorkerHandle)
pub fn from_options(
name: String,
permissions: Permissions,
main_module: ModuleSpecifier,
worker_id: WorkerId,
options: WebWorkerOptions
) -> (Self, SendableWebWorkerHandle)
pub fn bootstrap(&mut self, options: &BootstrapOptions)
sourcepub async fn preload_main_module(
&mut self,
module_specifier: &ModuleSpecifier
) -> Result<ModuleId, AnyError>
pub async fn preload_main_module(
&mut self,
module_specifier: &ModuleSpecifier
) -> Result<ModuleId, AnyError>
Loads and instantiates specified JavaScript module as “main” module.
sourcepub async fn preload_side_module(
&mut self,
module_specifier: &ModuleSpecifier
) -> Result<ModuleId, AnyError>
pub async fn preload_side_module(
&mut self,
module_specifier: &ModuleSpecifier
) -> Result<ModuleId, AnyError>
Loads and instantiates specified JavaScript module as “side” 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.
This method assumes that worker can’t be terminated when executing side module code.
sourcepub async fn execute_main_module(&mut self, id: ModuleId) -> Result<(), AnyError>
pub async fn execute_main_module(&mut self, id: ModuleId) -> Result<(), AnyError>
Loads, instantiates and executes specified JavaScript module.
This module will have “import.meta.main” equal to true.
pub async fn run_event_loop(
&mut self,
wait_for_inspector: bool
) -> Result<(), AnyError>
Auto Trait Implementations
impl !RefUnwindSafe for WebWorker
impl !Send for WebWorker
impl !Sync for WebWorker
impl Unpin for WebWorker
impl !UnwindSafe for WebWorker
Blanket Implementations
sourceimpl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
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 Twhere
V: MultiLane<T>,
impl<V, T> VZip<V> for Twhere
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