pub struct NetworkOptions { /* private fields */ }Expand description
Provides a way to configure low level network connection configurations
Implementations§
Source§impl NetworkOptions
impl NetworkOptions
pub const fn new() -> NetworkOptions
pub const fn set_tcp_nodelay(&mut self, nodelay: bool)
pub const fn set_tcp_send_buffer_size(&mut self, size: u32)
pub const fn set_tcp_recv_buffer_size(&mut self, size: u32)
Sourcepub const fn set_connection_timeout(
&mut self,
timeout: u64,
) -> &mut NetworkOptions
pub const fn set_connection_timeout( &mut self, timeout: u64, ) -> &mut NetworkOptions
set connection timeout in secs
Sourcepub const fn connection_timeout(&self) -> u64
pub const fn connection_timeout(&self) -> u64
get timeout in secs
Sourcepub const fn set_bind_addr(
&mut self,
bind_addr: SocketAddr,
) -> &mut NetworkOptions
pub const fn set_bind_addr( &mut self, bind_addr: SocketAddr, ) -> &mut NetworkOptions
Bind a connection to a specific local socket address.
When the address uses a fixed nonzero port, the default multi-address
dialer avoids overlapping attempts to prevent AddrInUse, which means
same-family fallback attempts are no longer staggered in parallel.
In that mode, an earlier candidate keeps the fixed port until it completes or the overall connect timeout expires. This preserves source port stability, but gives up happy-eyeballs-style fallback across same-family addresses.
pub const fn bind_addr(&self) -> Option<SocketAddr>
Sourcepub fn set_bind_device(&mut self, bind_device: &str) -> &mut NetworkOptions
Available on Android or Fuchsia or Linux only.
pub fn set_bind_device(&mut self, bind_device: &str) -> &mut NetworkOptions
bind connection to a specific network device by name
Trait Implementations§
Source§impl Clone for NetworkOptions
impl Clone for NetworkOptions
Source§fn clone(&self) -> NetworkOptions
fn clone(&self) -> NetworkOptions
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 NetworkOptions
impl Debug for NetworkOptions
Source§impl Default for NetworkOptions
impl Default for NetworkOptions
Source§fn default() -> NetworkOptions
fn default() -> NetworkOptions
Returns the “default value” for a type. Read more
Auto Trait Implementations§
impl Freeze for NetworkOptions
impl RefUnwindSafe for NetworkOptions
impl Send for NetworkOptions
impl Sync for NetworkOptions
impl Unpin for NetworkOptions
impl UnsafeUnpin for NetworkOptions
impl UnwindSafe for NetworkOptions
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