pub fn toggle(&mut self) -> Result<(String, StateOfPlay)> {
        let status = self._get_status()?;
        // below looks weird, but the "pause" command actually toggles play/pause
        // in mpd. "play" only starts playing if stopped.
        match status.state {
            StateOfPlay::Stop => self._command("play"),
            StateOfPlay::Pause => self._command("pause"),
            StateOfPlay::Play => self._command("pause"),
        }
    }
/// If music is playing, it pauses it. else it starts playing music
///
/// this function is specially designed for keyboards with a combined
/// play/pause mediakey. Look for a key with both a play triangle and the
/// two stripes pause logo. This function does what should happen if you press that button.
/// It starts playing if it isn't and it pauses playing if it is.
///
/// # Returns
/// A tuple (artist-title, state) with:
/// * the artist-title of the new song (the previous song, so to speak).
/// * the state of MPD (should be Play or Pause from the StateOfPlay enum).
/// or it returns an "error" message instead of artist-title if MPD is mad at you.
If music is playing, it pauses it. else it starts playing music
this function is specially designed for keyboards with a combined
play/pause mediakey. Look for a key with both a play triangle and the
two stripes pause logo. This function does what should happen if you press that button.
It starts playing if it isn't and it pauses playing if it is.
If music is playing it pauses it . else it starts playing music this function is specially designed for keyboards with a combined play / pause mediakey . Look for a key with both a play triangle and the two stripes pause logo . This function does what should happen if you press that button . It starts playing if it isn ' t and it pauses playing if it is .
pub fn toggle(&mut self) -> Result<(String, StateOfPlay)> {
        let status = self._get_status()?;
        // below looks weird, but the "pause" command actually toggles play/pause
        // in mpd. "play" only starts playing if stopped.
        match status.state {
            StateOfPlay::Stop => self._command("play"),
            StateOfPlay::Pause => self._command("pause"),
            StateOfPlay::Play => self._command("pause"),
        }
    }
pub fn toggle ( & mut self ) -> Result < ( String , StateOfPlay ) > { let status = self . _get_status ( ) ? ; // below looks weird, but the "pause" command actually toggles play/pause // in mpd. "play" only starts playing if stopped. match status . state { StateOfPlay :: Stop => self . _command ( " " ) , StateOfPlay :: Pause => self . _command ( " " ) , StateOfPlay :: Play => self . _command ( " " ) , } }
If music is playing, it pauses it.
If music is playing it pauses it .
&mut self
A tuple (artist-title, state) with:
the artist-title of the new song (the previous song, so to speak).
the state of MPD (should be Play or Pause from the StateOfPlay enum).
or it returns an "error" message instead of artist-title if MPD is mad at you.
A tuple ( artist - title state ) with : the artist - title of the new song ( the previous song so to speak ) . the state of MPD ( should be Play or Pause from the StateOfPlay enum ) . or it returns an " error " message instead of artist - title if MPD is mad at you .
&mut self