pub struct AsyncListeners { /* private fields */ }
Expand description
Handler for listening to system events.
Create one with AsyncListeners::default()
and pass it to block_on
, as
well as your future. See the module-level documentation for more.
Implementations§
Source§impl AsyncListeners
impl AsyncListeners
pub fn new() -> Self
Sourcepub fn timer(&self) -> &TimerListener
pub fn timer(&self) -> &TimerListener
Returns a TimerListener
instance, which may be used to schedule
timers.
Sourcepub fn yield_now(&self) -> Yield ⓘ
pub fn yield_now(&self) -> Yield ⓘ
Allows other tasks to run before coming back to this one. Useful when
doing something computationally intensive, to allow things like keyboard
handlers and timers to run. Note that the calculator will not go to
sleep if this is called in a loop. Use timer
instead if a delay is desired between each iteration. If no other tasks
are scheduled, this task is continued immediately.
Trait Implementations§
Source§impl Default for AsyncListeners
impl Default for AsyncListeners
Source§fn default() -> AsyncListeners
fn default() -> AsyncListeners
Returns the “default value” for a type. Read more
Auto Trait Implementations§
impl !Freeze for AsyncListeners
impl !RefUnwindSafe for AsyncListeners
impl !Send for AsyncListeners
impl !Sync for AsyncListeners
impl Unpin for AsyncListeners
impl !UnwindSafe for AsyncListeners
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