pub struct Client { /* private fields */ }Implementations§
Source§impl Client
impl Client
Sourcepub fn connect_any_version(paths: &Paths) -> Result<Option<Client>>
pub fn connect_any_version(paths: &Paths) -> Result<Option<Client>>
Connects to whatever daemon answers, of any version; None when nothing does.
Sourcepub fn connect_or_start(paths: &Paths) -> Result<Client>
pub fn connect_or_start(paths: &Paths) -> Result<Client>
Connects, starting this binary as the daemon when none answers, and replacing a daemon of an older version or another protocol; a newer daemon is an error, so an old window never kills its upgrade.
pub fn connect_or_start_with( paths: &Paths, exe: &Path, version: &str, ) -> Result<Client>
Sourcepub fn request(&self, account: &str, command: Command) -> Result<Event>
pub fn request(&self, account: &str, command: Command) -> Result<Event>
Sends and waits for the reply, up to 120 s unless reply_timeout says the command may take longer.
Sourcepub fn send(&self, account: &str, command: Command) -> bool
pub fn send(&self, account: &str, command: Command) -> bool
Sends without waiting; a refusal arrives as Event::CommandFailed on the subscription.
Sourcepub fn subscribe(&self) -> Result<Receiver<Event>>
pub fn subscribe(&self) -> Result<Receiver<Event>>
Every broadcast event from now on, plus refusals of send. Call once.
Sourcepub fn subscribe_waking(
&self,
wake: impl Fn() + Send + 'static,
) -> Result<Receiver<Event>>
pub fn subscribe_waking( &self, wake: impl Fn() + Send + 'static, ) -> Result<Receiver<Event>>
As subscribe, calling wake after each event and once the daemon hung up, so a window can repaint.
pub fn status(&self) -> Result<Status>
pub fn shutdown(&self) -> Result<()>
Sourcepub fn stop_and_wait(&self, paths: &Paths) -> Result<u32>
pub fn stop_and_wait(&self, paths: &Paths) -> Result<u32>
Stops the daemon and waits for its socket to go; returns the pid it had.
Trait Implementations§
Auto Trait Implementations§
impl !Freeze for Client
impl RefUnwindSafe for Client
impl Send for Client
impl Sync for Client
impl Unpin for Client
impl UnsafeUnpin for Client
impl UnwindSafe for Client
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