Struct calloop::LoopHandle
source · pub struct LoopHandle<Data> { /* private fields */ }
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
sourceimpl<Data: 'static> LoopHandle<Data>
impl<Data: 'static> LoopHandle<Data>
sourcepub fn insert_source<E: EventSource, F: FnMut(E::Event, &mut Data) + 'static>(
&self,
source: E,
callback: F
) -> Result<Source<E>, InsertError<E>>
pub fn insert_source<E: EventSource, F: FnMut(E::Event, &mut Data) + 'static>(
&self,
source: E,
callback: F
) -> Result<Source<E>, InsertError<E>>
Insert an 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.
sourcepub fn insert_idle<F: FnOnce(&mut Data) + 'static>(&self, callback: F) -> Idle
pub fn insert_idle<F: FnOnce(&mut Data) + 'static>(&self, callback: F) -> Idle
Insert 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.
Trait Implementations
sourceimpl<Data> Clone for LoopHandle<Data>
impl<Data> Clone for LoopHandle<Data>
sourcefn clone(&self) -> LoopHandle<Data>
fn clone(&self) -> LoopHandle<Data>
Returns a copy of the value. Read more
1.0.0 · sourcefn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source
. Read moreAuto Trait Implementations
impl<Data> !RefUnwindSafe for LoopHandle<Data>
impl<Data> !Send for LoopHandle<Data>
impl<Data> !Sync for LoopHandle<Data>
impl<Data> Unpin for LoopHandle<Data>
impl<Data> !UnwindSafe for LoopHandle<Data>
Blanket Implementations
sourceimpl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more