pub struct Dispatcher<'a, S, Data>(/* private fields */);
Expand description
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§
source§impl<'a, S, Data> Dispatcher<'a, S, Data>where
S: EventSource + 'a,
impl<'a, S, Data> Dispatcher<'a, S, Data>where
S: EventSource + 'a,
sourcepub fn as_source_ref(&self) -> Ref<'_, S>
pub fn as_source_ref(&self) -> Ref<'_, S>
Returns an immutable reference to the event source.
§Panics
Has the same semantics as RefCell::borrow()
.
The dispatcher being mutably borrowed while its events are dispatched, this method will panic if invoked from within the associated dispatching closure.
sourcepub fn as_source_mut(&self) -> RefMut<'_, S>
pub fn as_source_mut(&self) -> RefMut<'_, S>
Returns a mutable reference to the event source.
§Panics
Has the same semantics as RefCell::borrow_mut()
.
The dispatcher being mutably borrowed while its events are dispatched, this method will panic if invoked from within the associated dispatching closure.
sourcepub fn into_source_inner(self) -> S
pub fn into_source_inner(self) -> S
Consumes the Dispatcher and returns the inner event source.
§Panics
Panics if the Dispatcher
is still registered.
Trait Implementations§
source§impl<'a, S, Data> Clone for Dispatcher<'a, S, Data>
impl<'a, S, Data> Clone for Dispatcher<'a, S, Data>
source§fn clone(&self) -> Dispatcher<'a, S, Data>
fn clone(&self) -> Dispatcher<'a, S, Data>
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read moreAuto Trait Implementations§
impl<'a, S, Data> Freeze for Dispatcher<'a, S, Data>
impl<'a, S, Data> !RefUnwindSafe for Dispatcher<'a, S, Data>
impl<'a, S, Data> !Send for Dispatcher<'a, S, Data>
impl<'a, S, Data> !Sync for Dispatcher<'a, S, Data>
impl<'a, S, Data> Unpin for Dispatcher<'a, S, Data>
impl<'a, S, Data> !UnwindSafe for Dispatcher<'a, S, Data>
Blanket Implementations§
source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
source§unsafe fn clone_to_uninit(&self, dst: *mut T)
unsafe fn clone_to_uninit(&self, dst: *mut T)
clone_to_uninit
)