pub trait Idle {
type Stream: Read + Write;
// Required method
fn idle<'a>(
&'a mut self,
subsystems: &[Subsystem]
) -> Result<IdleGuard<'a, Self::Stream>, Error>;
// Provided method
fn wait(
&mut self,
subsystems: &[Subsystem]
) -> Result<Vec<Subsystem>, Error> { ... }
}
Expand description
This trait implements idle
command of MPD protocol
See module’s documentation for details.
Required Associated Types§
Required Methods§
sourcefn idle<'a>(
&'a mut self,
subsystems: &[Subsystem]
) -> Result<IdleGuard<'a, Self::Stream>, Error>
fn idle<'a>( &'a mut self, subsystems: &[Subsystem] ) -> Result<IdleGuard<'a, Self::Stream>, Error>
Start listening for events from a set of subsystems
If empty subsystems slice is given, wait for all event from any subsystem.
This method returns IdleGuard
, which takes mutable reference of an initial client,
thus disallowing any operations on this mpd connection.
You can call .get()
method of this struct to stop waiting and get all queued events
matching given subsystems filter. This call consumes a guard, stops waiting
and releases client object.
If the guard goes out of scope, wait lock is released as well, but all queued events will be silently ignored.