pub struct Daemon { /* private fields */ }
Expand description
The main daemon struct.
Implementations§
Source§impl Daemon
impl Daemon
Sourcepub fn get_state(&self) -> DaemonState
pub fn get_state(&self) -> DaemonState
Returns the current state of the daemon.
Sourcepub fn start(
&self,
on_start: impl FnOnce() -> Result<(), DaemonError>,
) -> Result<(), DaemonError>
pub fn start( &self, on_start: impl FnOnce() -> Result<(), DaemonError>, ) -> Result<(), DaemonError>
Starts the daemon with a synchronous callback.
Sourcepub fn stop(
&self,
on_stop: impl FnOnce() -> Result<(), DaemonError>,
) -> Result<(), DaemonError>
pub fn stop( &self, on_stop: impl FnOnce() -> Result<(), DaemonError>, ) -> Result<(), DaemonError>
Stops the daemon with a synchronous callback.
Sourcepub fn restart(
&self,
on_restart: impl Fn() -> Result<(), DaemonError> + Clone,
) -> Result<(), DaemonError>
pub fn restart( &self, on_restart: impl Fn() -> Result<(), DaemonError> + Clone, ) -> Result<(), DaemonError>
Restarts the daemon with a synchronous callback.
Sourcepub fn load_config(&mut self, config: &DaemonConfig) -> Result<(), DaemonError>
pub fn load_config(&mut self, config: &DaemonConfig) -> Result<(), DaemonError>
Loads configuration into the daemon.
Sourcepub async fn start_async<F, Fut>(&self, on_start: F) -> Result<(), DaemonError>
pub async fn start_async<F, Fut>(&self, on_start: F) -> Result<(), DaemonError>
Starts the daemon with an asynchronous callback (requires async
feature).
Sourcepub async fn stop_async<F, Fut>(&self, on_stop: F) -> Result<(), DaemonError>
pub async fn stop_async<F, Fut>(&self, on_stop: F) -> Result<(), DaemonError>
Stops the daemon with an asynchronous callback (requires async
feature).
Auto Trait Implementations§
impl Freeze for Daemon
impl RefUnwindSafe for Daemon
impl Send for Daemon
impl Sync for Daemon
impl Unpin for Daemon
impl UnwindSafe for Daemon
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