This is unreleased documentation for Yew Next version.
For up-to-date documentation, see the latest version on docs.rs.

Struct WorkerSpawner

Source
pub struct WorkerSpawner<W, CODEC = Bincode>
where W: Worker, CODEC: Codec,
{ /* private fields */ }
Expand description

A spawner to create workers.

Implementations§

Source§

impl<W, CODEC> WorkerSpawner<W, CODEC>
where W: Worker + 'static, CODEC: Codec,

Source

pub const fn new() -> Self

Creates a WorkerSpawner.

Source

pub fn encoding<C>(&mut self) -> WorkerSpawner<W, C>
where C: Codec,

Sets a new message encoding.

Source

pub fn callback<F>(&mut self, cb: F) -> &mut Self
where F: 'static + Fn(W::Output),

Sets a callback.

Source

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.

Source

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.

Source

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>
where W: Worker + Clone, CODEC: Codec + Clone, W::Output: Clone,

Source§

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)

Performs copy-assignment from source. Read more
Source§

impl<W, CODEC> Debug for WorkerSpawner<W, CODEC>
where W: Worker, CODEC: Codec,

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl<W, CODEC> Default for WorkerSpawner<W, CODEC>
where W: Worker + 'static, CODEC: Codec,

Source§

fn default() -> Self

Returns the “default value” for a type. Read more

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>
where W: Unpin, CODEC: Unpin,

§

impl<W, CODEC = Bincode> !UnwindSafe for WorkerSpawner<W, CODEC>

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

§

impl<T> Instrument for T

§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided [Span], returning an Instrumented wrapper. Read more
§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> IntoPropValue<Option<T>> for T

Source§

fn into_prop_value(self) -> Option<T>

Convert self to a value of a Properties struct.
Source§

impl<T> IntoPropValue<T> for T

Source§

fn into_prop_value(self) -> T

Convert self to a value of a Properties struct.
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
§

impl<T> WithSubscriber for T

§

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
§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a [WithDispatch] wrapper. Read more
Source§

impl<Token, Builder, How> AllPropsFor<Builder, How> for Token
where Builder: Buildable<Token>, <Builder as Buildable<Token>>::WrappedToken: HasAllProps<<Builder as Buildable<Token>>::Output, How>,

Source§

impl<T> HasAllProps<(), T> for T