[−][src]Trait libpulse_binding::mainloop::api::Mainloop
Associated Types
type MI: MainloopInnerType
Required methods
Loading content...Provided methods
fn new_io_event(
&mut self,
fd: i32,
events: IoEventFlagSet,
callback: Box<dyn FnMut(IoEventRef<Self::MI>, i32, IoEventFlagSet) + 'static>
) -> Option<IoEvent<Self::MI>>
&mut self,
fd: i32,
events: IoEventFlagSet,
callback: Box<dyn FnMut(IoEventRef<Self::MI>, i32, IoEventFlagSet) + 'static>
) -> Option<IoEvent<Self::MI>>
Create a new IO event
Note: You must ensure that the returned event object lives for as long as you want its
event(s) to fire, as its Drop
implementation destroys the event source. I.e. if you create
a new event, but then immediately drop the object returned here, no event will fire!
The given callback must accept three parameters, an IoEventRef
object, a copy of the
given file descriptor, and an event flag set, indicating the event(s) that occurred. The
DeferEventRef
object gives you some opportunity to manage the event source from within
it’s callback execution.
fn new_timer_event(
&mut self,
tv: &UnixTs,
callback: Box<dyn FnMut(TimeEventRef<Self::MI>) + 'static>
) -> Option<TimeEvent<Self::MI>>
&mut self,
tv: &UnixTs,
callback: Box<dyn FnMut(TimeEventRef<Self::MI>) + 'static>
) -> Option<TimeEvent<Self::MI>>
Create a new timer event
Note: You must ensure that the returned event object lives for as long as you want its
event(s) to fire, as its Drop
implementation destroys the event source. I.e. if you create
a new event, but then immediately drop the object returned here, no event will fire!
The callback must take a TimeEventRef
object, which gives you some opportunity to
manage the event source from within it’s callback execution.
Example event set to fire in five seconds time:
use pulse::time::{UnixTs, MicroSeconds, MICROS_PER_SEC}; let _t_event = mainloop.new_timer_event( &(UnixTs::now() + MicroSeconds(5 * MICROS_PER_SEC)), Box::new(|| { println!("Timer event fired!"); }));
fn new_timer_event_rt(
&mut self,
t: MonotonicTs,
callback: Box<dyn FnMut(TimeEventRef<Self::MI>) + 'static>
) -> Option<TimeEvent<Self::MI>>
&mut self,
t: MonotonicTs,
callback: Box<dyn FnMut(TimeEventRef<Self::MI>) + 'static>
) -> Option<TimeEvent<Self::MI>>
Create a new monotonic-based timer event
Asserts that t
is not USEC_INVALID
This is an alternative to the new_timer_event
method, taking a monotonic based time value.
Note: You must ensure that the returned event object lives for as long as you want its
event(s) to fire, as its Drop
implementation destroys the event source. I.e. if you create
a new event, but then immediately drop the object returned here, no event will fire!
The callback must take a TimeEventRef
object, which gives you some opportunity to
manage the event source from within it’s callback execution.
Example event set to fire in five seconds time:
use pulse::time::{MonotonicTs, MicroSeconds, MICROS_PER_SEC}; let _t_event = mainloop.new_timer_event_rt( MonotonicTs::now() + MicroSeconds(5 * MICROS_PER_SEC), Box::new(|| { println!("Timer event fired!"); }));
fn new_deferred_event(
&mut self,
callback: Box<dyn FnMut(DeferEventRef<Self::MI>) + 'static>
) -> Option<DeferEvent<Self::MI>>
&mut self,
callback: Box<dyn FnMut(DeferEventRef<Self::MI>) + 'static>
) -> Option<DeferEvent<Self::MI>>
Create a new deferred event
Note: You must ensure that the returned event object lives for as long as you want its
event(s) to fire, as its Drop
implementation destroys the event source. I.e. if you create
a new event, but then immediately drop the object returned here, no event will fire!
The callback must take a DeferEventRef
object, which gives you some opportunity to
manage the event source from within it’s callback execution.
fn once_event(&mut self, callback: Box<dyn FnMut() + 'static>)
Run the specified callback once from the main loop using an anonymous defer event.
If the mainloop runs in a different thread, you need to follow the mainloop implementation’s
rules regarding how to safely create defer events. In particular, if you’re using
::mainloop::threaded
, you must lock the mainloop before calling
this function.
fn quit(&mut self, retval: Retval)
Call quit
Implementors
impl Mainloop for libpulse_binding::mainloop::standard::Mainloop
[src]
type MI = MainloopInner<MainloopInternal>
fn inner(&self) -> Rc<MainloopInner<MainloopInternal>>
[src]
fn new_io_event(
&mut self,
fd: i32,
events: IoEventFlagSet,
callback: Box<dyn FnMut(IoEventRef<Self::MI>, i32, IoEventFlagSet) + 'static>
) -> Option<IoEvent<Self::MI>>
[src]
&mut self,
fd: i32,
events: IoEventFlagSet,
callback: Box<dyn FnMut(IoEventRef<Self::MI>, i32, IoEventFlagSet) + 'static>
) -> Option<IoEvent<Self::MI>>
fn new_timer_event(
&mut self,
tv: &UnixTs,
callback: Box<dyn FnMut(TimeEventRef<Self::MI>) + 'static>
) -> Option<TimeEvent<Self::MI>>
[src]
&mut self,
tv: &UnixTs,
callback: Box<dyn FnMut(TimeEventRef<Self::MI>) + 'static>
) -> Option<TimeEvent<Self::MI>>
fn new_timer_event_rt(
&mut self,
t: MonotonicTs,
callback: Box<dyn FnMut(TimeEventRef<Self::MI>) + 'static>
) -> Option<TimeEvent<Self::MI>>
[src]
&mut self,
t: MonotonicTs,
callback: Box<dyn FnMut(TimeEventRef<Self::MI>) + 'static>
) -> Option<TimeEvent<Self::MI>>
fn new_deferred_event(
&mut self,
callback: Box<dyn FnMut(DeferEventRef<Self::MI>) + 'static>
) -> Option<DeferEvent<Self::MI>>
[src]
&mut self,
callback: Box<dyn FnMut(DeferEventRef<Self::MI>) + 'static>
) -> Option<DeferEvent<Self::MI>>
fn once_event(&mut self, callback: Box<dyn FnMut() + 'static>)
[src]
fn quit(&mut self, retval: Retval)
[src]
impl Mainloop for libpulse_binding::mainloop::threaded::Mainloop
[src]
type MI = MainloopInner<MainloopInternal>
fn inner(&self) -> Rc<MainloopInner<MainloopInternal>>
[src]
fn new_io_event(
&mut self,
fd: i32,
events: IoEventFlagSet,
callback: Box<dyn FnMut(IoEventRef<Self::MI>, i32, IoEventFlagSet) + 'static>
) -> Option<IoEvent<Self::MI>>
[src]
&mut self,
fd: i32,
events: IoEventFlagSet,
callback: Box<dyn FnMut(IoEventRef<Self::MI>, i32, IoEventFlagSet) + 'static>
) -> Option<IoEvent<Self::MI>>
fn new_timer_event(
&mut self,
tv: &UnixTs,
callback: Box<dyn FnMut(TimeEventRef<Self::MI>) + 'static>
) -> Option<TimeEvent<Self::MI>>
[src]
&mut self,
tv: &UnixTs,
callback: Box<dyn FnMut(TimeEventRef<Self::MI>) + 'static>
) -> Option<TimeEvent<Self::MI>>
fn new_timer_event_rt(
&mut self,
t: MonotonicTs,
callback: Box<dyn FnMut(TimeEventRef<Self::MI>) + 'static>
) -> Option<TimeEvent<Self::MI>>
[src]
&mut self,
t: MonotonicTs,
callback: Box<dyn FnMut(TimeEventRef<Self::MI>) + 'static>
) -> Option<TimeEvent<Self::MI>>
fn new_deferred_event(
&mut self,
callback: Box<dyn FnMut(DeferEventRef<Self::MI>) + 'static>
) -> Option<DeferEvent<Self::MI>>
[src]
&mut self,
callback: Box<dyn FnMut(DeferEventRef<Self::MI>) + 'static>
) -> Option<DeferEvent<Self::MI>>