Struct calloop::Dispatcher[][src]

pub struct Dispatcher<S, F>(_);

An event source with its callback.

The Dispatcher can be registered in an event loop. Use the as_source_{ref,mut} functions to interact with the event source. Use into_source_inner to get the event source back.

Implementations

impl<S, F> Dispatcher<S, F> where
    S: EventSource
[src]

pub fn new<Data>(source: S, callback: F) -> Self where
    F: FnMut(S::Event, &mut S::Metadata, &mut Data) -> S::Ret
[src]

Builds a dispatcher.

The resulting Dispatcher

pub fn as_source_ref(&self) -> Ref<'_, S>[src]

Returns an immutable reference to the event source.

pub fn as_source_mut(&mut self) -> RefMut<'_, S>[src]

Returns a mutable reference to the event source.

pub fn into_source_inner(self) -> S[src]

Consumes the Dispatcher and returns the inner event source.

Panics

Panics if the Dispatcher is still registered.

Trait Implementations

impl<S, F> Clone for Dispatcher<S, F>[src]

Auto Trait Implementations

impl<S, F> !RefUnwindSafe for Dispatcher<S, F>[src]

impl<S, F> !Send for Dispatcher<S, F>[src]

impl<S, F> !Sync for Dispatcher<S, F>[src]

impl<S, F> Unpin for Dispatcher<S, F>[src]

impl<S, F> !UnwindSafe for Dispatcher<S, F>[src]

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.