[−][src]Struct mpd_client::client::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]
connection: C
) -> Result<(Self, impl Stream<Item = Result<Subsystem, StateChangeError>>), MpdCodecError> where
C: AsyncRead + AsyncWrite + Send + 'static,
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]
&'_ self,
command: Command
) -> Result<Frame, CommandError>
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]
&'_ self,
commands: CommandList
) -> Result<Vec<Frame>, CommandError>
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
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]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T> ToOwned for T where
T: Clone,
[src]
T: Clone,
type Owned = T
The resulting type after obtaining ownership.
fn to_owned(&self) -> T
[src]
fn clone_into(&self, target: &mut T)
[src]
impl<T, U> TryFrom<U> 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, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,