Struct calloop::EventLoop

source ·
pub struct EventLoop<Data> { /* private fields */ }
Expand description

An event loop

This loop can host several event sources, that can be dynamically added or removed.

Implementations

Create a new event loop

It is backed by an mio provided machinnery, and will fail if the mio initialization fails.

Retrieve a loop handle

Dispatch pending events to their callbacks

Some source have events available, their callbacks will be immediatly called. Otherwise this will wait until an event is receive or the provided timeout is reached. If timeout is None, it will wait without a duration limit.

Once pending events have been processed or the timeout is reached, all pending idle callbacks will be fired before this method returns.

Get a signal to stop this event loop from running

To be used in conjunction with the run() method.

Run this event loop

This will repeatedly try to dispatch events (see the dispatch() method) on this event loop, waiting at most timeout every time.

Between each dispatch wait, your provided callback will be called.

You can use the get_signal() method to retrieve a way to stop or wakeup the event loop from anywhere.

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more
Immutably borrows from an owned value. Read more
Mutably borrows from an owned value. Read more

Returns the argument unchanged.

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

The type returned in the event of a conversion error.
Performs the conversion.
The type returned in the event of a conversion error.
Performs the conversion.