pub struct WorkerSpawner<W, CODEC = Bincode>{ /* private fields */ }
Expand description
A spawner to create workers.
Implementations§
Source§impl<W, CODEC> WorkerSpawner<W, CODEC>
impl<W, CODEC> WorkerSpawner<W, CODEC>
Sourcepub const fn new() -> Self
pub const fn new() -> Self
Creates a WorkerSpawner.
Sourcepub fn encoding<C>(&mut self) -> WorkerSpawner<W, C>where
C: Codec,
pub fn encoding<C>(&mut self) -> WorkerSpawner<W, C>where
C: Codec,
Sets a new message encoding.
Sourcepub fn with_loader(&mut self, with_loader: bool) -> &mut Self
pub fn with_loader(&mut self, with_loader: bool) -> &mut Self
Indicates that spawn
should expect a
path
to a loader shim script (e.g. when using Trunk, created by using
the data-loader-shim
asset type) and one does not need to be generated. false
by default.
Sourcepub fn as_module(&mut self, as_module: bool) -> &mut Self
pub fn as_module(&mut self, as_module: bool) -> &mut Self
Determines whether the worker will be spawned with
options.type
set to module
. true
by default.
This option should be un-set if the worker was created with the
--target no-modules
flag of wasm-bindgen
. If using Trunk, see the
data-bindgen-target
asset type.
Sourcepub fn spawn(&self, path: &str) -> WorkerBridge<W>where
W::Input: Serialize + for<'de> Deserialize<'de>,
W::Output: Serialize + for<'de> Deserialize<'de>,
pub fn spawn(&self, path: &str) -> WorkerBridge<W>where
W::Input: Serialize + for<'de> Deserialize<'de>,
W::Output: Serialize + for<'de> Deserialize<'de>,
Spawns a Worker.
Trait Implementations§
Source§impl<W, CODEC> Clone for WorkerSpawner<W, CODEC>
impl<W, CODEC> Clone for WorkerSpawner<W, CODEC>
Source§fn clone(&self) -> WorkerSpawner<W, CODEC>
fn clone(&self) -> WorkerSpawner<W, CODEC>
Returns a copy of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source
. Read moreSource§impl<W, CODEC> Debug for WorkerSpawner<W, CODEC>
impl<W, CODEC> Debug for WorkerSpawner<W, CODEC>
Auto Trait Implementations§
impl<W, CODEC> Freeze for WorkerSpawner<W, CODEC>
impl<W, CODEC = Bincode> !RefUnwindSafe for WorkerSpawner<W, CODEC>
impl<W, CODEC = Bincode> !Send for WorkerSpawner<W, CODEC>
impl<W, CODEC = Bincode> !Sync for WorkerSpawner<W, CODEC>
impl<W, CODEC> Unpin for WorkerSpawner<W, CODEC>
impl<W, CODEC = Bincode> !UnwindSafe for WorkerSpawner<W, CODEC>
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoPropValue<Option<T>> for T
impl<T> IntoPropValue<Option<T>> for T
Source§fn into_prop_value(self) -> Option<T>
fn into_prop_value(self) -> Option<T>
Convert
self
to a value of a Properties
struct.Source§impl<T> IntoPropValue<T> for T
impl<T> IntoPropValue<T> for T
Source§fn into_prop_value(self) -> T
fn into_prop_value(self) -> T
Convert
self
to a value of a Properties
struct.