pub struct EventLoopGroup { /* private fields */ }Expand description
An event loop group collects one or more EventLoops together for processor affiniity and
load balancing purposes
Implementations§
Source§impl EventLoopGroup
impl EventLoopGroup
Sourcepub fn new_default(
allocator: &Allocator,
max_threads: Option<u16>,
on_shutdown: impl FnOnce() + Send + 'static,
) -> Result<EventLoopGroup, Error>
pub fn new_default( allocator: &Allocator, max_threads: Option<u16>, on_shutdown: impl FnOnce() + Send + 'static, ) -> Result<EventLoopGroup, Error>
Create a new default EventLoopGroup. max_threads: use None for the CRT default on_shutdown will be called when the event loop group shuts down.
Sourcepub fn get_next_loop(&self) -> Result<EventLoop, Error>
pub fn get_next_loop(&self) -> Result<EventLoop, Error>
Get the next event loop to schedule a task on. (Internally, the CRT will make a choice on which loop in the group will be returned.)
Sourcepub fn get_loop_count(&self) -> usize
pub fn get_loop_count(&self) -> usize
Get the number of loops in this group.
Trait Implementations§
Source§impl Clone for EventLoopGroup
impl Clone for EventLoopGroup
Source§fn clone(&self) -> EventLoopGroup
fn clone(&self) -> EventLoopGroup
Returns a duplicate 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 moreSource§impl Debug for EventLoopGroup
impl Debug for EventLoopGroup
Source§impl Drop for EventLoopGroup
impl Drop for EventLoopGroup
Source§impl Spawn for EventLoopGroup
impl Spawn for EventLoopGroup
Source§impl TaskScheduler for EventLoopGroup
Scheduling a task on an EventLoopGroup first finds the next EventLoop to use (as reported by
the CRT), then uses that one to run the Task.
impl TaskScheduler for EventLoopGroup
Scheduling a task on an EventLoopGroup first finds the next EventLoop to use (as reported by the CRT), then uses that one to run the Task.
Source§fn schedule_task_now(&self, task: Task) -> Result<(), Error>
fn schedule_task_now(&self, task: Task) -> Result<(), Error>
Schedule a Task to run as soon as possible. If the task is cancelled, it will be called
with TaskStatus::Canceled as an argument.
impl Send for EventLoopGroup
impl Sync for EventLoopGroup
Auto Trait Implementations§
impl Freeze for EventLoopGroup
impl RefUnwindSafe for EventLoopGroup
impl Unpin for EventLoopGroup
impl UnsafeUnpin for EventLoopGroup
impl UnwindSafe for EventLoopGroup
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> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<S> FutureSpawner for Swhere
S: TaskScheduler + Clone,
impl<S> FutureSpawner for Swhere
S: TaskScheduler + Clone,
Source§fn spawn_future<T>(
&self,
future: impl Future<Output = T> + Send + 'static,
) -> FutureJoinHandle<T>where
T: Send + 'static,
fn spawn_future<T>(
&self,
future: impl Future<Output = T> + Send + 'static,
) -> FutureJoinHandle<T>where
T: Send + 'static,
Spawn the given Future to run asynchronously. This TaskScheduler is responsible for
determining how to run Tasks in the CRT. This returns a FutureJoinHandle that can be
used to cancel, block on, or await the result. Read more
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<Sp> SpawnExt for Sp
impl<Sp> SpawnExt for Sp
Source§fn spawn<Fut>(&self, future: Fut) -> Result<(), SpawnError>
fn spawn<Fut>(&self, future: Fut) -> Result<(), SpawnError>
Spawns a task that polls the given future with output
() to
completion. Read moreSource§fn spawn_with_handle<Fut>(
&self,
future: Fut,
) -> Result<RemoteHandle<<Fut as Future>::Output>, SpawnError>
fn spawn_with_handle<Fut>( &self, future: Fut, ) -> Result<RemoteHandle<<Fut as Future>::Output>, SpawnError>
Spawns a task that polls the given future to completion and returns a
future that resolves to the spawned future’s output. Read more