[][src]Struct mpd_client::client::Client

pub struct Client(_);

Client for MPD.

Methods

impl Client[src]

pub async fn connect<C>(
    connection: C
) -> Result<(Self, impl Stream<Item = Result<Subsystem, StateChangeError>>), MpdCodecError> where
    C: AsyncRead + AsyncWrite + Send + 'static, 
[src]

Connect to the MPD server using the given connection.

Returns a Client you can use to issue commands, and a stream of state change events as returned by MPD.

Since this is generic over the connection type, you can use it with both TCP and Unix socket connections.

Panics

Since this spawns a task internally, this will panic when called outside a tokio runtime.

Errors

This will return an error if sending the initial commands over the given transport fails.

pub async fn command<'_>(
    &'_ self,
    command: Command
) -> Result<Frame, CommandError>
[src]

Send the given command, and return the response to it.

Errors

This will return an error if the connection to MPD is closed (cleanly) or a protocol error occurs (including IO errors), or if the command results in an MPD error.

pub async fn command_list<'_>(
    &'_ self,
    commands: CommandList
) -> Result<Vec<Frame>, CommandError>
[src]

Send the given command list, and return the responses to the contained commands.

Errors

Errors will be returned in the same conditions as with command, but if any of the commands in the list return an error condition, the entire list will be treated as an error. You may recover possible succesful fields in a response from the error variant.

Trait Implementations

impl Clone for Client[src]

impl Debug for Client[src]

Auto Trait Implementations

impl !RefUnwindSafe for Client

impl Send for Client

impl Sync for Client

impl Unpin for Client

impl !UnwindSafe for Client

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> From<T> for T[src]

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

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

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.