#[non_exhaustive]pub struct ListenerConfig {
pub reuse_port: bool,
pub reuse_addr: bool,
pub backlog: i32,
pub send_buf_size: Option<usize>,
pub recv_buf_size: Option<usize>,
pub tcp_fast_open: bool,
}
Expand description
Custom listener options
Fields (Non-exhaustive)§
This struct is marked as non-exhaustive
Non-exhaustive structs could have additional fields added in future. Therefore, non-exhaustive structs cannot be constructed in external crates using the traditional
Struct { .. }
syntax; cannot be matched against without a wildcard ..
; and struct update syntax will not work.reuse_port: bool
Whether to enable reuse_port.
reuse_addr: bool
Whether to enable reuse_addr.
backlog: i32
Backlog size.
send_buf_size: Option<usize>
Send buffer size or None to use default.
recv_buf_size: Option<usize>
Recv buffer size or None to use default.
tcp_fast_open: bool
TCP fast open.
Implementations§
Source§impl ListenerOpts
impl ListenerOpts
Sourcepub fn reuse_port(self, reuse_port: bool) -> Self
pub fn reuse_port(self, reuse_port: bool) -> Self
Enable SO_REUSEPORT
Sourcepub fn reuse_addr(self, reuse_addr: bool) -> Self
pub fn reuse_addr(self, reuse_addr: bool) -> Self
Enable SO_REUSEADDR
Sourcepub fn send_buf_size(self, send_buf_size: usize) -> Self
pub fn send_buf_size(self, send_buf_size: usize) -> Self
Specify SO_SNDBUF
Sourcepub fn recv_buf_size(self, recv_buf_size: usize) -> Self
pub fn recv_buf_size(self, recv_buf_size: usize) -> Self
Specify SO_RCVBUF
Sourcepub fn tcp_fast_open(self, fast_open: bool) -> Self
pub fn tcp_fast_open(self, fast_open: bool) -> Self
Specify FastOpen. Note: if it is enabled, the connection will be established on first peer data sent, which means data cannot be sent immediately after connection accepted if client does not send something.
Trait Implementations§
Source§impl Clone for ListenerOpts
impl Clone for ListenerOpts
Source§fn clone(&self) -> ListenerOpts
fn clone(&self) -> ListenerOpts
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 moreSource§impl Debug for ListenerOpts
impl Debug for ListenerOpts
Source§impl Default for ListenerOpts
impl Default for ListenerOpts
impl Copy for ListenerOpts
Auto Trait Implementations§
impl Freeze for ListenerOpts
impl RefUnwindSafe for ListenerOpts
impl Send for ListenerOpts
impl Sync for ListenerOpts
impl Unpin for ListenerOpts
impl UnwindSafe for ListenerOpts
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