pub struct EventListenerCfg<U>{ /* private fields */ }Expand description
The event listener configurator is used to setup an event listener.
Once you’re done with configuration just call EventListenerCfg::start and the event listener will start and the listener
will be returned.
Implementations§
source§impl<U> EventListenerCfg<U>
impl<U> EventListenerCfg<U>
sourcepub fn poll_timeout(self, timeout: Duration) -> Self
pub fn poll_timeout(self, timeout: Duration) -> Self
Set poll timeout. Poll timeout is the maximum time to wait when fetching the thread receiver.
Panics if timeout is 0
sourcepub fn tick_interval(self, interval: Duration) -> Self
pub fn tick_interval(self, interval: Duration) -> Self
Defines the tick interval for the event listener.
If an interval is defined, this will also enable the Tick event.
sourcepub fn add_port(
self,
poll: Box<dyn Poll<U>>,
interval: Duration,
max_poll: usize,
) -> Self
pub fn add_port( self, poll: Box<dyn Poll<U>>, interval: Duration, max_poll: usize, ) -> Self
Add a new Port (Poll, Interval) to the the event listener.
The interval is the amount of time between each Poll::poll call.
The max_poll is the maximum amount of times the port should be polled in a single poll.
sourcepub fn port(self, port: Port<U>) -> Self
pub fn port(self, port: Port<U>) -> Self
Add a new Port to the the event listener
The Port needs to be manually constructed, unlike Self::add_port
sourcepub fn crossterm_input_listener(
self,
interval: Duration,
max_poll: usize,
) -> Self
pub fn crossterm_input_listener( self, interval: Duration, max_poll: usize, ) -> Self
Add to the event listener the default crossterm input listener crate::terminal::CrosstermInputListener
The interval is the amount of time between each Poll::poll call.
The max_poll is the maximum amount of times the port should be polled in a single poll.
sourcepub fn termion_input_listener(self, interval: Duration, max_poll: usize) -> Self
pub fn termion_input_listener(self, interval: Duration, max_poll: usize) -> Self
Add to the event listener the default termion input listener crate::terminal::TermionInputListener
The interval is the amount of time between each Poll::poll call.
The max_poll is the maximum amount of times the port should be polled in a single poll.
Trait Implementations§
Auto Trait Implementations§
impl<U> Freeze for EventListenerCfg<U>
impl<U> !RefUnwindSafe for EventListenerCfg<U>
impl<U> Send for EventListenerCfg<U>
impl<U> !Sync for EventListenerCfg<U>
impl<U> Unpin for EventListenerCfg<U>
impl<U> !UnwindSafe for EventListenerCfg<U>
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> 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>
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>
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