pub struct OneshotSpawner<N, CODEC = Bincode>{ /* private fields */ }
Expand description
A spawner to create oneshot workers.
Implementations§
Source§impl<N, CODEC> OneshotSpawner<N, CODEC>
impl<N, CODEC> OneshotSpawner<N, CODEC>
Sourcepub const fn new() -> Self
pub const fn new() -> Self
Creates a OneshotSpawner.
Sourcepub const fn encoding<C>(&self) -> OneshotSpawner<N, C>where
C: Codec,
pub const fn encoding<C>(&self) -> OneshotSpawner<N, C>where
C: Codec,
Sets a new message encoding.
Sourcepub fn with_loader(self, with_loader: bool) -> Self
pub fn with_loader(self, with_loader: bool) -> 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(self, as_module: bool) -> Self
pub fn as_module(self, as_module: bool) -> 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) -> OneshotBridge<N>where
N::Input: Serialize + for<'de> Deserialize<'de>,
N::Output: Serialize + for<'de> Deserialize<'de>,
pub fn spawn(self, path: &str) -> OneshotBridge<N>where
N::Input: Serialize + for<'de> Deserialize<'de>,
N::Output: Serialize + for<'de> Deserialize<'de>,
Spawns a Oneshot Worker.
Trait Implementations§
Source§impl<N, CODEC> Debug for OneshotSpawner<N, CODEC>
impl<N, CODEC> Debug for OneshotSpawner<N, CODEC>
Auto Trait Implementations§
impl<N, CODEC> Freeze for OneshotSpawner<N, CODEC>
impl<N, CODEC = Bincode> !RefUnwindSafe for OneshotSpawner<N, CODEC>
impl<N, CODEC = Bincode> !Send for OneshotSpawner<N, CODEC>
impl<N, CODEC = Bincode> !Sync for OneshotSpawner<N, CODEC>
impl<N, CODEC> Unpin for OneshotSpawner<N, CODEC>where
CODEC: Unpin,
impl<N, CODEC = Bincode> !UnwindSafe for OneshotSpawner<N, 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
§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.