pub struct MultiHostClient { /* private fields */ }
Implementations§
Source§impl MultiHostClient
impl MultiHostClient
pub fn new(hosts: Vec<String>, 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>
pub async fn with_client<F, Fut, T>(&self, f: F) -> Result<T, Error>
Runs the provided callback as soon as a connected client is available,
using the most relevant client (see get_current_client
).
Sourcepub async fn recv(&mut self) -> Result<Arc<ConnectionEvent>, RecvError>
pub async fn recv(&mut self) -> Result<Arc<ConnectionEvent>, RecvError>
Receives on all clients, returning an event from the first one to respond.
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.
Auto Trait Implementations§
impl Freeze for MultiHostClient
impl RefUnwindSafe for MultiHostClient
impl Send for MultiHostClient
impl Sync for MultiHostClient
impl Unpin for MultiHostClient
impl UnwindSafe for MultiHostClient
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