Struct mpd_client::state_changes::StateChanges[][src]

pub struct StateChanges { /* fields omitted */ }

Stream of state change events.

This is emitted by MPD during the client idle loops. You can use this to keep local state such as the current volume or queue in sync with MPD. The stream ending (yielding None) indicates that the MPD server closed the connection, after which no more events will be emitted and attempting to send a command will return an error.

If you don’t care about these, you can just drop this receiver.

use mpd_client::Client;
use futures::stream::StreamExt; // For .next()

async fn print_songs() -> Result<(), Box<dyn std::error::Error>> {
    let (_client, mut state_changes) = Client::connect_to("localhost:6600").await?;

    while let Some(Ok(state_change)) = state_changes.next().await {
        println!("state change: {:?}", state_change);
    }

    Ok(())
}

Trait Implementations

impl Debug for StateChanges[src]

impl Stream for StateChanges[src]

type Item = Result<Subsystem, StateChangeError>

Values yielded by the stream.

Auto Trait Implementations

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> Conv for T

impl<T> Conv for T

impl<T> FmtForward for T

impl<T> From<T> for T[src]

impl<T> Instrument for T[src]

impl<T> Instrument for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> Pipe for T where
    T: ?Sized

impl<T> Pipe for T

impl<T> PipeAsRef for T

impl<T> PipeBorrow for T

impl<T> PipeDeref for T

impl<T> PipeRef for T

impl<T> StreamExt for T where
    T: Stream + ?Sized

impl<T> Tap for T

impl<T> Tap for T

impl<T, U> TapAsRef<U> for T where
    U: ?Sized

impl<T, U> TapBorrow<U> for T where
    U: ?Sized

impl<T> TapDeref for T

impl<T> TryConv for T

impl<T> TryConv for T

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.

impl<S, T, E> TryStream for S where
    S: Stream<Item = Result<T, E>> + ?Sized

type Ok = T

The type of successful values yielded by this future

type Error = E

The type of failures yielded by this future

impl<S> TryStreamExt for S where
    S: TryStream + ?Sized

impl<T> WithSubscriber for T[src]