pub struct MpdClient { /* private fields */ }
Expand description
Mpd Client
Implementations§
Source§impl MpdClient
impl MpdClient
pub async fn connect<A: AsyncToSocketAddrs>( &mut self, addr: A, ) -> Result<String, Error>
pub async fn reconnect(&mut self) -> Result<(), Error>
pub async fn status(&mut self) -> Result<Status, Error>
pub async fn update( &mut self, path: Option<&str>, ) -> Result<DatabaseVersion, Error>
pub async fn rescan( &mut self, path: Option<&str>, ) -> Result<DatabaseVersion, Error>
pub async fn idle(&mut self) -> Result<Subsystem, Error>
pub async fn noidle(&mut self) -> Result<(), Error>
pub async fn setvol(&mut self, volume: u32) -> Result<(), Error>
pub async fn repeat(&mut self, repeat: bool) -> Result<(), Error>
pub async fn random(&mut self, random: bool) -> Result<(), Error>
pub async fn consume(&mut self, consume: bool) -> Result<(), Error>
pub async fn play(&mut self) -> Result<(), Error>
pub async fn playid(&mut self, id: u32) -> Result<(), Error>
pub async fn pause(&mut self) -> Result<(), Error>
pub async fn play_pause(&mut self, play: bool) -> Result<(), Error>
pub async fn next(&mut self) -> Result<(), Error>
pub async fn prev(&mut self) -> Result<(), Error>
pub async fn stop(&mut self) -> Result<(), Error>
pub async fn listall( &mut self, path: Option<&str>, ) -> Result<ListallResponse, Error>
pub async fn listallinfo( &mut self, path: Option<&str>, ) -> Result<ListallinfoResponse, Error>
pub async fn queue_add(&mut self, path: &str) -> Result<(), Error>
pub async fn queue_clear(&mut self) -> Result<(), Error>
pub async fn queue(&mut self) -> Result<Vec<Track>, Error>
Sourcepub async fn search(&mut self, filter: &Filter) -> Result<Vec<Track>, Error>
pub async fn search(&mut self, filter: &Filter) -> Result<Vec<Track>, Error>
§Example
use async_mpd::{MpdClient, Error, Tag, Filter, ToFilterExpr};
#[async_std::main]
async fn main() -> Result<(), Error> {
// Connect to server
let mut mpd = MpdClient::new();
mpd.connect("localhost:6600").await?;
let mut filter = Filter::new()
.and(Tag::Artist.equals("The Beatles"))
.and(Tag::Album.contains("White"));
let res = mpd.search(&filter).await?;
println!("{:?}", res);
Ok(())
}
Sourcepub async fn exec_wrapped<C>(
&mut self,
cmd: C,
) -> Result<WrappedResponse, Error>where
C: MpdCmd,
pub async fn exec_wrapped<C>(
&mut self,
cmd: C,
) -> Result<WrappedResponse, Error>where
C: MpdCmd,
Execute a Mpd Command. Returns a enum wrapped Response
Trait Implementations§
Auto Trait Implementations§
impl Freeze for MpdClient
impl RefUnwindSafe for MpdClient
impl Send for MpdClient
impl Sync for MpdClient
impl Unpin for MpdClient
impl UnwindSafe for MpdClient
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self
into a Left
variant of Either<Self, Self>
if into_left
is true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self
into a Left
variant of Either<Self, Self>
if into_left(&self)
returns true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read more