Struct mpd_utils::MultiHostClient
source · pub struct MultiHostClient<'a> { /* private fields */ }Implementations§
source§impl<'a> MultiHostClient<'a>
impl<'a> MultiHostClient<'a>
pub fn new(hosts: &'a [&'a str], retry_interval: Duration) -> Self
sourcepub async fn wait_for_any_client(&self) -> Arc<Client>
pub async fn wait_for_any_client(&self) -> Arc<Client>
Waits until any of the clients make a valid connection to their host.
sourcepub async fn wait_for_all_clients(&self) -> Vec<Arc<Client>>
pub async fn wait_for_all_clients(&self) -> Vec<Arc<Client>>
Waits until all of the clients make a valid connection to their host.
sourcepub async fn with_client<F, Fut, T>(&self, f: F) -> Result<T, Error>where
F: FnOnce(Arc<Client>) -> Fut,
Fut: Future<Output = T>,
pub async fn with_client<F, Fut, T>(&self, f: F) -> Result<T, Error>where F: FnOnce(Arc<Client>) -> Fut, Fut: Future<Output = T>,
Runs the provided callback as soon as a connected client is available,
using the most relevant client (see get_current_client).
pub async fn recv(&mut self) -> Option<ConnectionEvent>
sourcepub async fn current_song(&self) -> Result<Option<SongInQueue>, Error>
pub async fn current_song(&self) -> Result<Option<SongInQueue>, Error>
Runs the currentsong command on the MPD server.