pub struct TcpServerConfig {
pub address: SocketAddr,
pub buffer_size: usize,
pub max_connections: Option<usize>,
pub no_delay: bool,
pub keep_alive: Option<Duration>,
}Expand description
Configuration for TCP server.
Controls server behavior including bind address, buffer sizes, connection limits, and socket options. Use TcpServerConfig::builder() for ergonomic construction.
§Socket Options
- no_delay: When enabled (default), disables Nagle’s algorithm for lower latency
- keep_alive: Configures SO_KEEPALIVE to detect dead connections
§Resource Limits
- buffer_size: Size of read buffers allocated from the pool
- max_connections: Hard limit on concurrent connections (None for unlimited)
Fields§
§address: SocketAddrAddress to bind to
buffer_size: usizeSize of connection buffer
max_connections: Option<usize>Maximum number of connections
no_delay: boolEnable TCP_NODELAY
keep_alive: Option<Duration>SO_KEEPALIVE setting
Implementations§
Source§impl TcpServerConfig
impl TcpServerConfig
Sourcepub fn builder() -> TcpServerConfigBuilder
pub fn builder() -> TcpServerConfigBuilder
Create a new builder for TcpServerConfig
Trait Implementations§
Source§impl Clone for TcpServerConfig
impl Clone for TcpServerConfig
Source§fn clone(&self) -> TcpServerConfig
fn clone(&self) -> TcpServerConfig
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 moreAuto Trait Implementations§
impl Freeze for TcpServerConfig
impl RefUnwindSafe for TcpServerConfig
impl Send for TcpServerConfig
impl Sync for TcpServerConfig
impl Unpin for TcpServerConfig
impl UnsafeUnpin for TcpServerConfig
impl UnwindSafe for TcpServerConfig
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