hyperlane/hook/struct.rs
1use crate::*;
2
3/// Default server hook
4#[derive(
5 Clone, Copy, Debug, Deserialize, DisplayDebug, Eq, Hash, Ord, PartialEq, PartialOrd, Serialize,
6)]
7pub struct DefaultServerHook;
8
9/// Represents the hooks for managing the server's lifecycle, specifically for waiting and shutting down.
10#[derive(Clone, CustomDebug, DisplayDebug, Getter, Setter)]
11pub struct ServerControlHook {
12 /// A hook that returns a future, which completes when the server's main task finishes.
13 /// This is typically used to wait for the server to stop accepting connections before
14 /// the application exits.
15 #[debug(skip)]
16 #[get(pub)]
17 #[set(pub(crate))]
18 pub(super) wait_hook: ServerControlHookHandler<()>,
19 /// A hook that, when called, initiates a graceful shutdown of the server.
20 /// This will stop the server from accepting new connections and allow existing ones
21 /// to complete.
22 #[debug(skip)]
23 #[get(pub)]
24 #[set(pub(crate))]
25 pub(super) shutdown_hook: ServerControlHookHandler<()>,
26}