Struct gpui2::BackgroundExecutor
source · pub struct BackgroundExecutor { /* private fields */ }
Implementations§
source§impl BackgroundExecutor
impl BackgroundExecutor
pub fn new(dispatcher: Arc<dyn PlatformDispatcher>) -> Self
sourcepub fn spawn<R>(
&self,
future: impl Future<Output = R> + Send + 'static
) -> Task<R> ⓘwhere
R: Send + 'static,
pub fn spawn<R>( &self, future: impl Future<Output = R> + Send + 'static ) -> Task<R> ⓘwhere R: Send + 'static,
Enqueues the given future to be run to completion on a background thread.
sourcepub fn spawn_labeled<R>(
&self,
label: TaskLabel,
future: impl Future<Output = R> + Send + 'static
) -> Task<R> ⓘwhere
R: Send + 'static,
pub fn spawn_labeled<R>( &self, label: TaskLabel, future: impl Future<Output = R> + Send + 'static ) -> Task<R> ⓘwhere R: Send + 'static,
Enqueues the given future to be run to completion on a background thread. The given label can be used to control the priority of the task in tests.
pub fn block<R>(&self, future: impl Future<Output = R>) -> R
pub fn block_with_timeout<R>( &self, duration: Duration, future: impl Future<Output = R> ) -> Result<R, impl Future<Output = R>>
pub async fn scoped<'scope, F>(&self, scheduler: F)where F: FnOnce(&mut Scope<'scope>),
pub fn timer(&self, duration: Duration) -> Task<()> ⓘ
pub fn num_cpus(&self) -> usize
pub fn is_main_thread(&self) -> bool
Trait Implementations§
source§impl Clone for BackgroundExecutor
impl Clone for BackgroundExecutor
source§fn clone(&self) -> BackgroundExecutor
fn clone(&self) -> BackgroundExecutor
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 moreAuto Trait Implementations§
impl !RefUnwindSafe for BackgroundExecutor
impl Send for BackgroundExecutor
impl Sync for BackgroundExecutor
impl Unpin for BackgroundExecutor
impl !UnwindSafe for BackgroundExecutor
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