pub(crate) struct EventHandler {
rx: UnboundedReceiver<Message>,
tx: UnboundedSender<Message>,
cmd_tx: UnboundedSender<RadioCommand>,
cmd_rx: Option<UnboundedReceiver<RadioCommand>>,
}Expand description
Merges terminal key events with messages from background tasks.
Fields§
§rx: UnboundedReceiver<Message>§tx: UnboundedSender<Message>§cmd_tx: UnboundedSender<RadioCommand>§cmd_rx: Option<UnboundedReceiver<RadioCommand>>Implementations§
Source§impl EventHandler
impl EventHandler
Sourcepub(crate) fn new() -> Self
pub(crate) fn new() -> Self
Create a new event handler with internal message and command channels.
Sourcepub(crate) fn sender(&self) -> UnboundedSender<Message>
pub(crate) fn sender(&self) -> UnboundedSender<Message>
Returns a sender that background tasks can use to push messages.
Sourcepub(crate) fn command_sender(&self) -> UnboundedSender<RadioCommand>
pub(crate) fn command_sender(&self) -> UnboundedSender<RadioCommand>
Returns a sender the app can use to send commands to the radio task.
Sourcepub(crate) const fn take_command_receiver(
&mut self,
) -> UnboundedReceiver<RadioCommand>
pub(crate) const fn take_command_receiver( &mut self, ) -> UnboundedReceiver<RadioCommand>
Takes the command receiver (can only be called once).
§Panics
Panics if the command receiver has already been taken.
Auto Trait Implementations§
impl Freeze for EventHandler
impl RefUnwindSafe for EventHandler
impl Send for EventHandler
impl Sync for EventHandler
impl Unpin for EventHandler
impl UnwindSafe for EventHandler
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
Mutably borrows from an owned value. Read more
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more