Skip to main content

EventLoopGroup

Struct EventLoopGroup 

Source
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

Source

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.

Source

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

Source

pub fn get_loop_count(&self) -> usize

Get the number of loops in this group.

Trait Implementations§

Source§

impl Clone for EventLoopGroup

Source§

fn clone(&self) -> EventLoopGroup

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 Debug for EventLoopGroup

Source§

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

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

impl Drop for EventLoopGroup

Source§

fn drop(&mut self)

Executes the destructor for this type. Read more
Source§

impl Spawn for EventLoopGroup

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

Source§

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

impl Send for EventLoopGroup

Source§

impl Sync for EventLoopGroup

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> 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<S> FutureSpawner for S
where S: TaskScheduler + Clone,

Source§

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

Source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
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> 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.
Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more