[][src]Struct calloop::LoopHandle

pub struct LoopHandle<Data> { /* fields omitted */ }

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]

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]

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]

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]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.