LocalScopeSpawner

Struct LocalScopeSpawner 

Source
pub struct LocalScopeSpawner<'sc, T> { /* private fields */ }
Expand description

A spawner that can be obtained from LocalScope::spawner.

This spawner may live longer then the scope. In case a future is spawned after the scope has been canceled or dropped, the spawner will return SpawnError::shutdown.

Implementations§

Source§

impl<'sc, T> LocalScopeSpawner<'sc, T>

Source

pub fn spawn_scoped_local_obj( &self, future: LocalFutureObj<'sc, T>, ) -> Result<(), SpawnError>

Spawns a task that polls the given local future.

§Errors

This method returns a Result that contains a SpawnError if spawning fails.

Source

pub fn spawn_local_scoped<Fut>(&self, future: Fut) -> Result<(), SpawnError>
where Fut: Future<Output = T> + 'sc,

Spawns a task that polls the given local future.

§Errors

This method returns a Result that contains a SpawnError if spawning fails.

Source§

impl<'sc> LocalScopeSpawner<'sc, ()>

Source

pub fn spawn_local_scoped_with_handle<Fut>( &self, future: Fut, ) -> Result<RemoteHandle<Fut::Output>, SpawnError>
where Fut: Future + 'sc,

Spawns a task that polls the given local future and returns a handle to its output.

§Errors

This method returns a Result that contains a SpawnError if spawning fails.

Trait Implementations§

Source§

impl<'sc, T> Clone for LocalScopeSpawner<'sc, T>

Source§

fn clone(&self) -> Self

Returns a duplicate 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<'sc, T: Debug> Debug for LocalScopeSpawner<'sc, T>

Source§

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

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

impl<'sc> LocalSpawn for LocalScopeSpawner<'sc, ()>

Source§

fn spawn_local_obj( &self, future: LocalFutureObj<'static, ()>, ) -> Result<(), SpawnError>

Spawns a future that will be run to completion. Read more
Source§

fn status_local(&self) -> Result<(), SpawnError>

Determines whether the executor is able to spawn new tasks. Read more
Source§

impl<'sc, T> ScopedSpawn<'sc, T> for LocalScopeSpawner<'sc, T>

Source§

fn spawn_obj_scoped(&self, future: FutureObj<'sc, T>) -> Result<(), SpawnError>

Spawns a task that polls the given future. Read more
Source§

fn status_scoped(&self) -> Result<(), SpawnError>

Determines whether the scope is able to spawn new tasks. Read more
Source§

impl<'sc> Spawn for LocalScopeSpawner<'sc, ()>

Source§

fn spawn_obj(&self, future: FutureObj<'static, ()>) -> Result<(), SpawnError>

Spawns a future that will be run to completion. Read more
Source§

fn status(&self) -> Result<(), SpawnError>

Determines whether the executor is able to spawn new tasks. Read more

Auto Trait Implementations§

§

impl<'sc, T> Freeze for LocalScopeSpawner<'sc, T>

§

impl<'sc, T> !RefUnwindSafe for LocalScopeSpawner<'sc, T>

§

impl<'sc, T> !Send for LocalScopeSpawner<'sc, T>

§

impl<'sc, T> !Sync for LocalScopeSpawner<'sc, T>

§

impl<'sc, T> Unpin for LocalScopeSpawner<'sc, T>

§

impl<'sc, T> !UnwindSafe for LocalScopeSpawner<'sc, T>

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.

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<Sp> LocalSpawnExt for Sp
where Sp: LocalSpawn + ?Sized,

Source§

fn spawn_local<Fut>(&self, future: Fut) -> Result<(), SpawnError>
where Fut: Future<Output = ()> + 'static,

Spawns a task that polls the given future with output () to completion. Read more
Source§

fn spawn_local_with_handle<Fut>( &self, future: Fut, ) -> Result<RemoteHandle<<Fut as Future>::Output>, SpawnError>
where Fut: Future + 'static,

Spawns a task that polls the given future to completion and returns a future that resolves to the spawned future’s output. Read more
Source§

impl<Sp> RelayScopeLocalSpawning for Sp
where Sp: LocalSpawn + Clone,

Source§

fn spawn_scope<'sc>(&self, scope: &RelayScope<'sc>) -> Result<(), SpawnError>
where Self: 'sc,

Add this spawn to scope and relay spawned futures to it.
Source§

impl<'sc, T, Sp> ScopedSpawnExt<'sc, T> for Sp
where Sp: ScopedSpawn<'sc, T> + ?Sized,

Source§

fn spawn_scoped<Fut>(&self, future: Fut) -> Result<(), SpawnError>
where Fut: Future<Output = T> + Send + 'a,

Spawns a task that polls the given future. Read more
Source§

fn spawn_scoped_with_handle<Fut>( &self, future: Fut, ) -> Result<RemoteHandle<Fut::Output>, SpawnError>
where Fut: Future + Send + 'a, Fut::Output: Send + 'a, Self: ScopedSpawnExt<'a, ()>,

Spawns a task that polls the given future and returns a handle to its output. Read more
Source§

impl<Sp> SpawnExt for Sp
where Sp: Spawn + ?Sized,

Source§

fn spawn<Fut>(&self, future: Fut) -> Result<(), SpawnError>
where Fut: Future<Output = ()> + Send + 'static,

Spawns a task that polls the given future with output () to completion. Read more
Source§

fn spawn_with_handle<Fut>( &self, future: Fut, ) -> Result<RemoteHandle<<Fut as Future>::Output>, SpawnError>
where Fut: Future + Send + 'static, <Fut as Future>::Output: Send,

Spawns a task that polls the given future to completion and returns a future that resolves to the spawned future’s output. Read more
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.