Skip to main content

PlatformScheduler

Struct PlatformScheduler 

Source
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

Source

pub fn new(dispatcher: Arc<dyn PlatformDispatcher>) -> Self

Creates a scheduler that dispatches work through the given platform dispatcher.

Source

pub fn foreground_executor(self: &Arc<Self>) -> LocalExecutor

Creates a foreground executor backed by this scheduler.

Trait Implementations§

Source§

impl Scheduler for PlatformScheduler

Source§

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>, )

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, )

Schedule a background task with the given priority.
Source§

fn spawn_realtime(&self, f: Box<dyn FnOnce() + Send>)

Spawn a closure on a dedicated realtime thread for audio processing.
Source§

fn timer(&self, duration: Duration) -> Timer ⓘ

Source§

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>> ⓘ

Spawn a closure on a fresh session pinned to its own LocalExecutor. Read more
Source§

fn as_test(&self) -> Option<&TestScheduler>

Source§

fn schedule_background(&self, runnable: Runnable<RunnableMeta>)

Schedule a background task with default (medium) priority.

Auto Trait Implementations§

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> 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<T> IntoEither for T

Source§

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 more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
where F: FnOnce(&Self) -> bool,

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
Source§

impl<T> Pointable for T

Source§

const ALIGN: usize

The alignment of pointer.
Source§

type Init = T

The type for initializers.
Source§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
Source§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
Source§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
Source§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
Source§

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

Source§

type Error = !

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

fn try_from(value: U) -> Result<T, !>

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.
Source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V