Skip to main content

hyperlane/server/
struct.rs

1use super::*;
2
3/// Represents the internal, mutable state of the web server.
4///
5/// This struct consolidates all the core components required for the server to operate,
6/// including configuration, routing, middleware, and various hooks for extending functionality.
7#[derive(Clone, CustomDebug, Data, DisplayDebug)]
8pub struct Server {
9    /// Stores the server's configuration settings, such as address, port, and timeouts.
10    pub(super) server_config: ServerConfig,
11    /// The configuration for HTTP request.
12    pub(super) request_config: RequestConfig,
13    /// The routing component responsible for matching incoming requests to their registered handlers.
14    #[set(skip)]
15    pub(super) route_matcher: RouteMatcher,
16    /// A collection of request error handlers that are invoked when a request error occurs during HTTP request processing.
17    #[debug(skip)]
18    #[set(skip)]
19    pub(super) request_error: ServerHookList,
20    /// A collection of task panic handlers that are invoked when a panic occurs during request processing.
21    #[debug(skip)]
22    #[set(skip)]
23    pub(super) task_panic: ServerHookList,
24    /// A collection of request middleware handlers.
25    #[debug(skip)]
26    #[set(skip)]
27    pub(super) request_middleware: ServerHookList,
28    /// A collection of response middleware handlers.
29    #[debug(skip)]
30    #[set(skip)]
31    pub(super) response_middleware: ServerHookList,
32}