Struct calloop::LoopHandle [−][src]
pub struct LoopHandle<'l, Data> { /* fields omitted */ }
Expand description
An handle to an event loop
This handle allows you to insert new sources and idles in this event loop, it can be cloned, and it is possible to insert new sources from within a source callback.
Implementations
pub fn insert_source<S, F>(
&self,
source: S,
callback: F
) -> Result<RegistrationToken, InsertError<S>> where
S: EventSource + 'l,
F: FnMut(S::Event, &mut S::Metadata, &mut Data) -> S::Ret + 'l,
pub fn insert_source<S, F>(
&self,
source: S,
callback: F
) -> Result<RegistrationToken, InsertError<S>> where
S: EventSource + 'l,
F: FnMut(S::Event, &mut S::Metadata, &mut Data) -> S::Ret + 'l,
Inserts a new event source in the loop.
The provided callback will be called during the dispatching cycles whenever the
associated source generates events, see EventLoop::dispatch(..)
for details.
This function takes ownership of the event source. Use register_dispatcher
if you need access to the event source after this call.
pub fn register_dispatcher<S>(
&self,
dispatcher: Dispatcher<'l, S, Data>
) -> Result<RegistrationToken> where
S: EventSource + 'l,
pub fn register_dispatcher<S>(
&self,
dispatcher: Dispatcher<'l, S, Data>
) -> Result<RegistrationToken> where
S: EventSource + 'l,
Registers a Dispatcher
in the loop.
Use this function if you need access to the event source after its insertion in the loop.
See also insert_source
.
Inserts an idle callback.
This callback will be called during a dispatching cycle when the event loop has finished processing all pending events from the sources and becomes idle.
Enables this previously disabled event source.
This previously disabled source will start generating events again.
Note: This cannot be done from within the callback of the same source.
Makes this source update its registration.
If after accessing the source you changed its parameters in a way that requires updating its registration.
Note: This cannot be done from within the callback of the same source.
Disables this event source.
The source remains in the event loop, but it’ll no longer generate events
Note: This cannot be done from within the callback of the same source.
Removes this source from the event loop.
Note: This cannot be done from within the callback of the same source.
Removes this source from the event loop.
Note: This can be done from within the callback of the same source.
Wrap an IO object into an async adapter
This adapter turns the IO object into an async-aware one that can be used in futures. The readiness of these futures will be driven by the event loop.
The produced futures can be polled in any executor, and notably the one provided by calloop.
Trait Implementations
Auto Trait Implementations
impl<'l, Data> !RefUnwindSafe for LoopHandle<'l, Data>
impl<'l, Data> !Send for LoopHandle<'l, Data>
impl<'l, Data> !Sync for LoopHandle<'l, Data>
impl<'l, Data> Unpin for LoopHandle<'l, Data>
impl<'l, Data> !UnwindSafe for LoopHandle<'l, Data>
Blanket Implementations
Mutably borrows from an owned value. Read more