pub struct ServerManager<F> { /* private fields */ }
Expand description
Main structure for managing server processes.
Encapsulates all server management operations and holds necessary configuration.
Implementations§
Source§impl<F, Fut> ServerManager<F>
Implementation of server management operations.
impl<F, Fut> ServerManager<F>
Implementation of server management operations.
Provides methods for starting, stopping and managing server processes.
Sourcepub fn new(config: ServerManagerConfig, server_fn: F) -> ServerManager<F>
pub fn new(config: ServerManagerConfig, server_fn: F) -> ServerManager<F>
Sourcepub async fn start(&self)
pub async fn start(&self)
Starts the server in foreground mode.
Writes the current process ID to the PID file and executes the server function.
§Returns
()
- No return value.
Sourcepub fn stop(&self) -> Result<(), Box<dyn Error>>
pub fn stop(&self) -> Result<(), Box<dyn Error>>
Stops the running server process.
Reads PID from file and terminates the process.
§Returns
ServerManagerResult
- Operation result.
Sourcepub fn start_daemon(&self) -> Result<(), Box<dyn Error>>
pub fn start_daemon(&self) -> Result<(), Box<dyn Error>>
Starts the server in daemon (background) mode on Unix platforms.
§Returns
ServerManagerResult
- Operation result.
Trait Implementations§
Source§impl<F> Clone for ServerManager<F>where
F: Clone,
impl<F> Clone for ServerManager<F>where
F: Clone,
Source§fn clone(&self) -> ServerManager<F>
fn clone(&self) -> ServerManager<F>
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source
. Read moreAuto Trait Implementations§
impl<F> Freeze for ServerManager<F>where
F: Freeze,
impl<F> RefUnwindSafe for ServerManager<F>where
F: RefUnwindSafe,
impl<F> Send for ServerManager<F>where
F: Send,
impl<F> Sync for ServerManager<F>where
F: Sync,
impl<F> Unpin for ServerManager<F>where
F: Unpin,
impl<F> UnwindSafe for ServerManager<F>where
F: UnwindSafe,
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