pub struct ServerControlHook { /* private fields */ }Expand description
Represents the hooks for managing the server’s lifecycle, specifically for waiting and shutting down.
This struct is returned by the run method and provides two key hooks:
wait_hook- A future that resolves when the server has stopped accepting new connections.shutdown_hook- A function that can be called to gracefully shut down the server.
Implementations§
Source§impl ServerControlHook
Manages server lifecycle hooks, including waiting and shutdown procedures.
impl ServerControlHook
Manages server lifecycle hooks, including waiting and shutdown procedures.
This struct holds closures that are executed during specific server lifecycle events.
Source§impl ServerControlHook
impl ServerControlHook
pub fn get_wait_hook(&self) -> &SharedAsyncTaskFactory<()>
pub fn get_shutdown_hook(&self) -> &SharedAsyncTaskFactory<()>
Trait Implementations§
Source§impl Clone for ServerControlHook
impl Clone for ServerControlHook
Source§fn clone(&self) -> ServerControlHook
fn clone(&self) -> ServerControlHook
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 moreSource§impl Debug for ServerControlHook
impl Debug for ServerControlHook
Source§impl Default for ServerControlHook
Provides a default implementation for ServerControlHook.
impl Default for ServerControlHook
Provides a default implementation for ServerControlHook.
Source§fn default() -> Self
fn default() -> Self
Creates a new ServerControlHook instance with default no-op hooks.
The default wait_hook and shutdown_hook do nothing, allowing the server
to run without specific shutdown or wait logic unless configured otherwise.
§Returns
Self- A newServerControlHookinstance with default hooks.
Auto Trait Implementations§
impl Freeze for ServerControlHook
impl !RefUnwindSafe for ServerControlHook
impl Send for ServerControlHook
impl Sync for ServerControlHook
impl Unpin for ServerControlHook
impl !UnwindSafe for ServerControlHook
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