pub struct ConnectionOptions {
pub connect_timeout: Duration,
pub recv_timeout: Duration,
pub send_timeout: Duration,
pub tcp_keepalive: bool,
pub tcp_keepalive_idle: Duration,
pub tcp_keepalive_interval: Duration,
pub tcp_keepalive_count: u32,
pub tcp_nodelay: bool,
}Expand description
Connection timeout and TCP options
Fields§
§connect_timeout: DurationConnection timeout (default: 5 seconds)
recv_timeout: DurationReceive timeout (0 = no timeout)
send_timeout: DurationSend timeout (0 = no timeout)
tcp_keepalive: boolEnable TCP keepalive
tcp_keepalive_idle: DurationTCP keepalive idle time (default: 60 seconds)
tcp_keepalive_interval: DurationTCP keepalive interval (default: 5 seconds)
tcp_keepalive_count: u32TCP keepalive probe count (default: 3)
tcp_nodelay: boolEnable TCP_NODELAY (disable Nagle’s algorithm)
Implementations§
Source§impl ConnectionOptions
impl ConnectionOptions
Sourcepub fn connect_timeout(self, timeout: Duration) -> Self
pub fn connect_timeout(self, timeout: Duration) -> Self
Set connection timeout
Sourcepub fn recv_timeout(self, timeout: Duration) -> Self
pub fn recv_timeout(self, timeout: Duration) -> Self
Set receive timeout
Sourcepub fn send_timeout(self, timeout: Duration) -> Self
pub fn send_timeout(self, timeout: Duration) -> Self
Set send timeout
Sourcepub fn tcp_keepalive(self, enabled: bool) -> Self
pub fn tcp_keepalive(self, enabled: bool) -> Self
Enable TCP keepalive
Sourcepub fn tcp_keepalive_idle(self, duration: Duration) -> Self
pub fn tcp_keepalive_idle(self, duration: Duration) -> Self
Set TCP keepalive idle time
Sourcepub fn tcp_keepalive_interval(self, duration: Duration) -> Self
pub fn tcp_keepalive_interval(self, duration: Duration) -> Self
Set TCP keepalive interval
Sourcepub fn tcp_keepalive_count(self, count: u32) -> Self
pub fn tcp_keepalive_count(self, count: u32) -> Self
Set TCP keepalive probe count
Sourcepub fn tcp_nodelay(self, enabled: bool) -> Self
pub fn tcp_nodelay(self, enabled: bool) -> Self
Enable/disable TCP_NODELAY
Trait Implementations§
Source§impl Clone for ConnectionOptions
impl Clone for ConnectionOptions
Source§fn clone(&self) -> ConnectionOptions
fn clone(&self) -> ConnectionOptions
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 ConnectionOptions
impl Debug for ConnectionOptions
Auto Trait Implementations§
impl Freeze for ConnectionOptions
impl RefUnwindSafe for ConnectionOptions
impl Send for ConnectionOptions
impl Sync for ConnectionOptions
impl Unpin for ConnectionOptions
impl UnwindSafe for ConnectionOptions
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