#[non_exhaustive]pub struct TcpOptions {
pub nodelay: Option<bool>,
pub keepalive: Option<Keepalive>,
pub linger: Option<Linger>,
pub send_buffer: Option<u32>,
pub receive_buffer: Option<u32>,
pub ttl: Option<u8>,
}Expand description
Options applied to each accepted or dialed TCP connection. None leaves the OS default.
use net_io::{Keepalive, TcpOptions};
let opts = TcpOptions::new().nodelay(true).keepalive(Keepalive::DEFAULT);
assert_eq!(opts.nodelay, Some(true));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.nodelay: Option<bool>TCP_NODELAY.
keepalive: Option<Keepalive>Keepalive probes.
linger: Option<Linger>Linger at close.
send_buffer: Option<u32>SO_SNDBUF.
receive_buffer: Option<u32>SO_RCVBUF.
ttl: Option<u8>Hop limit (IP_TTL / IPV6_UNICAST_HOPS).
Implementations§
Source§impl TcpOptions
impl TcpOptions
Sourcepub fn new() -> TcpOptions
pub fn new() -> TcpOptions
Every option at the OS default.
Sourcepub fn nodelay(self, on: bool) -> TcpOptions
pub fn nodelay(self, on: bool) -> TcpOptions
TCP_NODELAY.
Sourcepub fn keepalive(self, k: Keepalive) -> TcpOptions
pub fn keepalive(self, k: Keepalive) -> TcpOptions
Keepalive probes.
Sourcepub fn linger(self, l: Linger) -> TcpOptions
pub fn linger(self, l: Linger) -> TcpOptions
Linger at close.
Sourcepub fn send_buffer(self, bytes: u32) -> TcpOptions
pub fn send_buffer(self, bytes: u32) -> TcpOptions
SO_SNDBUF.
Sourcepub fn receive_buffer(self, bytes: u32) -> TcpOptions
pub fn receive_buffer(self, bytes: u32) -> TcpOptions
SO_RCVBUF.
Sourcepub fn ttl(self, hops: u8) -> TcpOptions
pub fn ttl(self, hops: u8) -> TcpOptions
Hop limit.
Trait Implementations§
Source§impl Clone for TcpOptions
impl Clone for TcpOptions
impl Copy for TcpOptions
Source§impl Debug for TcpOptions
impl Debug for TcpOptions
Source§impl Default for TcpOptions
impl Default for TcpOptions
impl Eq for TcpOptions
Source§impl PartialEq for TcpOptions
impl PartialEq for TcpOptions
impl StructuralPartialEq for TcpOptions
Auto Trait Implementations§
impl Freeze for TcpOptions
impl RefUnwindSafe for TcpOptions
impl Send for TcpOptions
impl Sync for TcpOptions
impl Unpin for TcpOptions
impl UnsafeUnpin for TcpOptions
impl UnwindSafe for TcpOptions
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