[−][src]Struct libpulse_glib_binding::Mainloop
This acts as a safe interface to the internal PA Mainloop.
The mainloop object pointers are further enclosed here in a ref counted wrapper, allowing this outer wrapper to have clean methods for creating event objects, which can cleanly pass a copy of the inner ref counted mainloop object to them. Giving this to events serves two purposes, firstly because they need the API pointer, secondly, it ensures that event objects do not outlive the mainloop object.
Fields
_inner: Rc<MainloopInner<MainloopInternal>>
The ref-counted inner data
Methods
impl Mainloop
[src]
pub fn new(context: Option<&mut GMainContext>) -> Option<Self>
[src]
Create a new GLIB main loop object for the specified GLIB main loop context.
Takes an argument context
for the GMainContext
to use. If context is None
the default
context is used.
This returns the object in an Rc wrapper, allowing multiple references to be held, which allows event objects to hold one, thus ensuring they do not outlive it.
pub fn get_api<'a>(&self) -> &'a MainloopApi
[src]
Return the abstract main loop abstraction layer vtable for this main loop.
No need to free the API as it is owned by the loop and is destroyed when the loop is freed.
Talking to PA directly with C requires fetching this pointer explicitly via this function. This is actually unnecessary through this binding. The pointer is retrieved automatically upon Mainloop creation, stored internally, and automatically obtained from it by functions that need it.
Trait Implementations
impl Mainloop for Mainloop
[src]
type MI = MainloopInner<MainloopInternal>
fn inner(&self) -> Rc<MainloopInner<MainloopInternal>>
[src]
fn new_io_event(
&mut self,
fd: i32,
events: u32,
callback: Box<dyn FnMut(IoEventRef<Self::MI>, i32, u32) + 'static>
) -> Option<IoEvent<Self::MI>>
[src]
&mut self,
fd: i32,
events: u32,
callback: Box<dyn FnMut(IoEventRef<Self::MI>, i32, u32) + 'static>
) -> Option<IoEvent<Self::MI>>
Create a new IO event Read more
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>>
Create a new timer event Read more
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>>
Create a new monotonic-based timer event Read more
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>>
Create a new deferred event Read more
fn once_event(&mut self, callback: Box<dyn FnMut() + 'static>)
[src]
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. Read more
fn quit(&mut self, retval: Retval)
[src]
Call quit
impl MainloopSignals for Mainloop
[src]
fn init_signals(&mut self) -> Result<(), PAErr>
[src]
Initialize the UNIX signal subsystem and bind it to the specified main loop
fn signals_done(&self)
[src]
Cleanup the signal subsystem
Auto Trait Implementations
Blanket Implementations
impl<T, U> Into for T where
U: From<T>,
[src]
U: From<T>,
impl<T> From for T
[src]
impl<T, U> TryFrom for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T> Borrow for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T, U> TryInto for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,
type Error = <U as TryFrom<T>>::Error
The type returned in the event of a conversion error.
fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>
[src]
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,