pub struct LeptosExecutor;Expand description
A global async executor that can spawn tasks.
Implementations§
Source§impl Executor
impl Executor
Sourcepub fn spawn(fut: impl Future<Output = ()> + Send + 'static)
pub fn spawn(fut: impl Future<Output = ()> + Send + 'static)
Spawns a thread-safe Future.
Uses the globally configured executor. Panics if no global executor has been initialized.
Sourcepub fn spawn_local(fut: impl Future<Output = ()> + 'static)
pub fn spawn_local(fut: impl Future<Output = ()> + 'static)
Spawns a Future that cannot be sent across threads.
Uses the globally configured executor. Panics if no global executor has been initialized.
Sourcepub async fn tick()
pub async fn tick()
Waits until the next “tick” of the current async executor. Respects the global executor.
Sourcepub fn poll_local()
pub fn poll_local()
Polls the global async executor.
Uses the globally configured executor. Does nothing if the global executor does not support polling.
Source§impl Executor
impl Executor
Sourcepub fn init_wasm_bindgen() -> Result<(), ExecutorError>
pub fn init_wasm_bindgen() -> Result<(), ExecutorError>
Globally sets the [wasm-bindgen-futures] runtime as the executor used to spawn tasks.
Returns Err(_) if a global executor has already been set.
Requires the wasm-bindgen feature to be activated on this crate.
Sourcepub fn init_futures_executor() -> Result<(), ExecutorError>
pub fn init_futures_executor() -> Result<(), ExecutorError>
Globally sets the futures executor as the executor used to spawn tasks,
lazily creating a thread pool to spawn tasks into.
Returns Err(_) if a global executor has already been set.
Requires the futures-executor feature to be activated on this crate.
Sourcepub fn init_custom_executor(
custom_executor: impl CustomExecutor + Send + Sync + 'static,
) -> Result<(), ExecutorError>
pub fn init_custom_executor( custom_executor: impl CustomExecutor + Send + Sync + 'static, ) -> Result<(), ExecutorError>
Globally sets a custom executor as the executor used to spawn tasks.
Requires the custom executor to be Send + Sync as it will be stored statically.
Returns Err(_) if a global executor has already been set.
Sourcepub fn init_local_custom_executor(
custom_executor: impl CustomExecutor + 'static,
) -> Result<(), ExecutorError>
pub fn init_local_custom_executor( custom_executor: impl CustomExecutor + 'static, ) -> Result<(), ExecutorError>
Sets a custom executor for the current thread only.
This overrides the global executor for calls to spawn, spawn_local, and poll_local
made from the current thread. It does not affect other threads or the global state.
The provided custom_executor must implement CustomExecutor and 'static, but does
not need to be Send or Sync.
Returns Err(ExecutorError::AlreadySet) if a local executor has already been set
for this thread.
Auto Trait Implementations§
impl Forget for Executor
impl Freeze for Executor
impl Move for Executor
impl RefUnwindSafe for Executor
impl Send for Executor
impl Sync for Executor
impl Unpin for Executor
impl UnsafeUnpin for Executor
impl UnwindSafe for Executor
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
impl<A, B, T> HttpServerConnExec<A, B> for Twhere
B: Body,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
Source§fn in_current_span(self) -> Instrumented<Self> ⓘ
fn in_current_span(self) -> Instrumented<Self> ⓘ
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more