pub struct PlatformScheduler { /* private fields */ }Expand description
A production implementation of Scheduler that wraps a [PlatformDispatcher].
This allows GPUI to use the scheduler crate’s executor types with the platform’s native dispatch mechanisms (e.g., Grand Central Dispatch on macOS).
Implementations§
Source§impl PlatformScheduler
impl PlatformScheduler
Sourcepub fn new(dispatcher: Arc<dyn PlatformDispatcher>) -> Self
pub fn new(dispatcher: Arc<dyn PlatformDispatcher>) -> Self
Creates a scheduler that dispatches work through the given platform dispatcher.
Sourcepub fn foreground_executor(self: &Arc<Self>) -> LocalExecutor
pub fn foreground_executor(self: &Arc<Self>) -> LocalExecutor
Creates a foreground executor backed by this scheduler.
Trait Implementations§
Source§impl Scheduler for PlatformScheduler
impl Scheduler for PlatformScheduler
Source§fn block(
&self,
_session_id: Option<SessionId>,
future: Pin<&mut dyn Future<Output = ()>>,
timeout: Option<Duration>,
) -> bool
fn block( &self, _session_id: Option<SessionId>, future: Pin<&mut dyn Future<Output = ()>>, timeout: Option<Duration>, ) -> bool
Block until the given future completes or timeout occurs. Read more
Source§fn schedule_local(
&self,
_session_id: SessionId,
runnable: Runnable<RunnableMeta>,
)
fn schedule_local( &self, _session_id: SessionId, runnable: Runnable<RunnableMeta>, )
Schedule a runnable on the local (session-pinned) queue for
session_id.
Runnables scheduled here run in order on whichever thread drains the
session — the main thread for ordinary sessions, or a dedicated OS
thread for sessions created via spawn_dedicated_thread.Source§fn schedule_background_with_priority(
&self,
runnable: Runnable<RunnableMeta>,
priority: Priority,
)
fn schedule_background_with_priority( &self, runnable: Runnable<RunnableMeta>, priority: Priority, )
Schedule a background task with the given priority.
Source§fn spawn_realtime(&self, f: Box<dyn FnOnce() + Send>)
fn spawn_realtime(&self, f: Box<dyn FnOnce() + Send>)
Spawn a closure on a dedicated realtime thread for audio processing.
fn timer(&self, duration: Duration) -> Timer ⓘ
fn clock(&self) -> Arc<dyn Clock> ⓘ
Source§fn spawn_dedicated(
self: Arc<Self>,
f: Box<dyn FnOnce(LocalExecutor) -> Pin<Box<dyn Future<Output = Box<dyn Any + Send + Sync>> + 'static>> + Send + 'static>,
) -> Task<Box<dyn Any + Send + Sync>> ⓘ
fn spawn_dedicated( self: Arc<Self>, f: Box<dyn FnOnce(LocalExecutor) -> Pin<Box<dyn Future<Output = Box<dyn Any + Send + Sync>> + 'static>> + Send + 'static>, ) -> Task<Box<dyn Any + Send + Sync>> ⓘ
Spawn a closure on a fresh session pinned to its own
LocalExecutor. Read morefn as_test(&self) -> Option<&TestScheduler>
Source§fn schedule_background(&self, runnable: Runnable<RunnableMeta>)
fn schedule_background(&self, runnable: Runnable<RunnableMeta>)
Schedule a background task with default (medium) priority.
Auto Trait Implementations§
impl !Freeze for PlatformScheduler
impl !RefUnwindSafe for PlatformScheduler
impl !UnwindSafe for PlatformScheduler
impl Send for PlatformScheduler
impl Sync for PlatformScheduler
impl Unpin for PlatformScheduler
impl UnsafeUnpin for PlatformScheduler
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
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> ⓘ
Converts
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> ⓘ
Converts
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