pub struct ServerConfig {
pub mode: ServeMode,
pub port: u16,
pub host: String,
pub health_check_timeout: Duration,
pub health_check_interval: Duration,
}Expand description
Configuration for launching the web server.
Fields§
§mode: ServeModeServer mode (static folder or external child process).
port: u16Requested port (0 for dynamic port selection).
host: StringHost interface to bind (default: “127.0.0.1”).
health_check_timeout: DurationHealth check timeout.
health_check_interval: DurationHealth check retry interval.
Implementations§
Source§impl ServerConfig
impl ServerConfig
Sourcepub fn static_dir(root_dir: impl Into<PathBuf>) -> Self
pub fn static_dir(root_dir: impl Into<PathBuf>) -> Self
Create static server config for a root directory on a dynamic port (0).
Sourcepub fn command(cmd: impl Into<String>, args: Vec<String>) -> Self
pub fn command(cmd: impl Into<String>, args: Vec<String>) -> Self
Create command server config for running dx serve or custom CLI.
Sourcepub fn with_cwd(self, cwd: impl Into<PathBuf>) -> Self
pub fn with_cwd(self, cwd: impl Into<PathBuf>) -> Self
Set the working directory for command mode.
Sourcepub fn with_timeout(self, timeout: Duration) -> Self
pub fn with_timeout(self, timeout: Duration) -> Self
Set the health check timeout.
Trait Implementations§
Source§impl Clone for ServerConfig
impl Clone for ServerConfig
Source§fn clone(&self) -> ServerConfig
fn clone(&self) -> ServerConfig
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · 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 Freeze for ServerConfig
impl RefUnwindSafe for ServerConfig
impl Send for ServerConfig
impl Sync for ServerConfig
impl Unpin for ServerConfig
impl UnsafeUnpin for ServerConfig
impl UnwindSafe for ServerConfig
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