pub struct HttpConfig {
pub bind_addr: SocketAddr,
pub max_connections: usize,
pub buffer_size: usize,
pub read_timeout: Duration,
pub write_timeout: Duration,
pub server_name: Option<String>,
pub echo_headers: bool,
pub default_content_type: Option<String>,
}Expand description
Configuration for HTTP echo server
Extends StreamConfig with HTTP-specific configuration options.
§Examples
use echosrv::http::HttpConfig;
use std::time::Duration;
let config = HttpConfig {
bind_addr: "127.0.0.1:8080".parse().unwrap(),
max_connections: 100,
buffer_size: 8192, // Larger buffer for HTTP
read_timeout: Duration::from_secs(30),
write_timeout: Duration::from_secs(30),
server_name: Some("EchoServer/1.0".to_string()),
echo_headers: true,
default_content_type: Some("text/plain".to_string()),
};Fields§
§bind_addr: SocketAddrNetwork address to bind to
max_connections: usizeMaximum number of concurrent connections
buffer_size: usizeBuffer size for reading/writing data
read_timeout: DurationRead timeout for connections
write_timeout: DurationWrite timeout for connections
server_name: Option<String>Server name to include in responses (optional)
echo_headers: boolWhether to echo back request headers in response
default_content_type: Option<String>Default content type for responses
Trait Implementations§
Source§impl Clone for HttpConfig
impl Clone for HttpConfig
Source§fn clone(&self) -> HttpConfig
fn clone(&self) -> HttpConfig
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 moreSource§impl Debug for HttpConfig
impl Debug for HttpConfig
Source§impl Default for HttpConfig
impl Default for HttpConfig
Source§impl From<HttpConfig> for StreamConfig
impl From<HttpConfig> for StreamConfig
Source§fn from(config: HttpConfig) -> Self
fn from(config: HttpConfig) -> Self
Converts to this type from the input type.
Auto Trait Implementations§
impl Freeze for HttpConfig
impl RefUnwindSafe for HttpConfig
impl Send for HttpConfig
impl Sync for HttpConfig
impl Unpin for HttpConfig
impl UnsafeUnpin for HttpConfig
impl UnwindSafe for HttpConfig
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