Struct libpulse_tokio::TokioMain
source · pub struct TokioMain { /* private fields */ }
Implementations§
source§impl TokioMain
impl TokioMain
pub fn new() -> Self
sourcepub fn tick(&mut self, ctx: &mut Context<'_>) -> Poll<Option<Retval>>
pub fn tick(&mut self, ctx: &mut Context<'_>) -> Poll<Option<Retval>>
Run callbacks and register wakers for the pulse mainloop.
This returns Ready if a callback was invoked, or Pending if everything is waiting on timers or I/O. The async run() or wait_for_ready() functions call this function internally.
sourcepub async fn wait_for_ready(&mut self, ctx: &Context) -> Result<State, Retval>
pub async fn wait_for_ready(&mut self, ctx: &Context) -> Result<State, Retval>
Run the mainloop until the given context is either Ready or Failed/Terminated.
When initializing a single Context object, this can be simpler use than registering a state callback. You will need to call run on another task to actually use the context.
Trait Implementations§
source§impl Mainloop for TokioMain
impl Mainloop for TokioMain
source§fn new_io_event(
&mut self,
fd: i32,
events: FlagSet,
callback: Box<dyn FnMut(IoEventRef<Self::MI>, i32, FlagSet)>
) -> Option<IoEvent<Self::MI>>
fn new_io_event( &mut self, fd: i32, events: FlagSet, callback: Box<dyn FnMut(IoEventRef<Self::MI>, i32, FlagSet)> ) -> Option<IoEvent<Self::MI>>
Creates a new IO event. Read more
source§fn new_timer_event(
&mut self,
tv: &UnixTs,
callback: Box<dyn FnMut(TimeEventRef<Self::MI>)>
) -> Option<TimeEvent<Self::MI>>
fn new_timer_event( &mut self, tv: &UnixTs, callback: Box<dyn FnMut(TimeEventRef<Self::MI>)> ) -> Option<TimeEvent<Self::MI>>
Creates a new timer event. Read more
source§fn new_timer_event_rt(
&mut self,
t: MonotonicTs,
callback: Box<dyn FnMut(TimeEventRef<Self::MI>)>
) -> Option<TimeEvent<Self::MI>>
fn new_timer_event_rt( &mut self, t: MonotonicTs, callback: Box<dyn FnMut(TimeEventRef<Self::MI>)> ) -> Option<TimeEvent<Self::MI>>
Creates a new monotonic-based timer event. Read more
source§fn new_deferred_event(
&mut self,
callback: Box<dyn FnMut(DeferEventRef<Self::MI>)>
) -> Option<DeferEvent<Self::MI>>
fn new_deferred_event( &mut self, callback: Box<dyn FnMut(DeferEventRef<Self::MI>)> ) -> Option<DeferEvent<Self::MI>>
Creates a new deferred event. Read more
Auto Trait Implementations§
impl !RefUnwindSafe for TokioMain
impl !Send for TokioMain
impl !Sync for TokioMain
impl Unpin for TokioMain
impl !UnwindSafe for TokioMain
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