[−][src]Struct calloop::LoopHandle
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
impl<Data> LoopHandle<Data>
[src]
pub fn insert_source<S, F>(
&self,
source: S,
callback: F
) -> Result<Source<S>, InsertError<S>> where
S: EventSource + 'static,
F: FnMut(S::Event, &mut S::Metadata, &mut Data) -> S::Ret + 'static,
[src]
&self,
source: S,
callback: F
) -> Result<Source<S>, InsertError<S>> where
S: EventSource + 'static,
F: FnMut(S::Event, &mut S::Metadata, &mut Data) -> S::Ret + 'static,
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.
pub fn insert_idle<F: FnOnce(&mut Data) + 'static>(&self, callback: F) -> Idle
[src]
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.
pub fn with_source<S: EventSource + 'static, T, F: FnOnce(&mut S) -> T>(
&self,
source: &Source<S>,
f: F
) -> T
[src]
&self,
source: &Source<S>,
f: F
) -> T
Access this event source
This allows you to modify the event source without removing it from the event loop if it allows it.
Note that replacing it with an other using mem::replace
or equivalent would not
correctly update its registration and generate errors. Instead you should remove
the source using the remove()
method and then insert a new one.
Note: This cannot be done from within the callback of the same source.
pub fn enable<E: EventSource>(&self, source: &Source<E>) -> Result<()>
[src]
Enable 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.
pub fn update<E: EventSource>(&self, source: &Source<E>) -> Result<()>
[src]
Make 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.
pub fn disable<E: EventSource>(&self, source: &Source<E>) -> Result<()>
[src]
Disable 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.
pub fn remove<S: EventSource + 'static>(&self, source: Source<S>) -> S
[src]
Remove this source from the event loop
You are givent the EventSource
back.
Note: This cannot be done from within the callback of the same source.
pub fn kill<S: EventSource + 'static>(&self, source: Source<S>)
[src]
Remove this event source from the event loop and drop it
The source is not given back to you but instead dropped
Note: This can be done from within the callback of the same source
Trait Implementations
impl<Data> Clone for LoopHandle<Data>
[src]
fn clone(&self) -> LoopHandle<Data>
[src]
fn clone_from(&mut self, source: &Self)
1.0.0[src]
Auto 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
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T> ToOwned for T where
T: Clone,
[src]
T: Clone,
type Owned = T
The resulting type after obtaining ownership.
fn to_owned(&self) -> T
[src]
fn clone_into(&self, target: &mut T)
[src]
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,