pub trait NetConnection:
NetStream
+ AsRawFd
+ Debug {
type Addr: Address;
Show 19 methods
// Required methods
fn connect_blocking(addr: Self::Addr, timeout: Duration) -> Result<Self>
where Self: Sized;
fn connect_nonblocking(addr: Self::Addr, timeout: Duration) -> Result<Self>
where Self: Sized;
fn connect_reusable_nonblocking(
local_addr: Self::Addr,
remote_addr: Self::Addr,
) -> Result<Self>
where Self: Sized;
fn shutdown(&mut self, how: Shutdown) -> Result<()>;
fn remote_addr(&self) -> Result<Self::Addr>;
fn local_addr(&self) -> Result<Self::Addr>;
fn set_tcp_keepalive(&mut self, keepalive: &TcpKeepalive) -> Result<()>;
fn set_read_timeout(&mut self, dur: Option<Duration>) -> Result<()>;
fn set_write_timeout(&mut self, dur: Option<Duration>) -> Result<()>;
fn read_timeout(&self) -> Result<Option<Duration>>;
fn write_timeout(&self) -> Result<Option<Duration>>;
fn peek(&self, buf: &mut [u8]) -> Result<usize>;
fn set_nodelay(&mut self, nodelay: bool) -> Result<()>;
fn nodelay(&self) -> Result<bool>;
fn set_ttl(&mut self, ttl: u32) -> Result<()>;
fn ttl(&self) -> Result<u32>;
fn set_nonblocking(&mut self, nonblocking: bool) -> Result<()>;
fn try_clone(&self) -> Result<Self>
where Self: Sized;
fn take_error(&self) -> Result<Option<Error>>;
}Expand description
Network stream is an abstraction of TCP stream object.
Required Associated Types§
Required Methods§
fn connect_blocking(addr: Self::Addr, timeout: Duration) -> Result<Self>where
Self: Sized,
fn connect_nonblocking(addr: Self::Addr, timeout: Duration) -> Result<Self>where
Self: Sized,
Available on crate feature
nonblocking only.fn connect_reusable_nonblocking(
local_addr: Self::Addr,
remote_addr: Self::Addr,
) -> Result<Self>where
Self: Sized,
Available on crate feature
nonblocking only.fn shutdown(&mut self, how: Shutdown) -> Result<()>
fn remote_addr(&self) -> Result<Self::Addr>
fn local_addr(&self) -> Result<Self::Addr>
fn set_tcp_keepalive(&mut self, keepalive: &TcpKeepalive) -> Result<()>
Available on crate feature
nonblocking only.fn set_read_timeout(&mut self, dur: Option<Duration>) -> Result<()>
fn set_write_timeout(&mut self, dur: Option<Duration>) -> Result<()>
fn read_timeout(&self) -> Result<Option<Duration>>
fn write_timeout(&self) -> Result<Option<Duration>>
fn peek(&self, buf: &mut [u8]) -> Result<usize>
fn set_nodelay(&mut self, nodelay: bool) -> Result<()>
fn nodelay(&self) -> Result<bool>
fn set_ttl(&mut self, ttl: u32) -> Result<()>
fn ttl(&self) -> Result<u32>
fn set_nonblocking(&mut self, nonblocking: bool) -> Result<()>
fn try_clone(&self) -> Result<Self>where
Self: Sized,
fn take_error(&self) -> Result<Option<Error>>
Implementations on Foreign Types§
Source§impl NetConnection for TcpStream
impl NetConnection for TcpStream
type Addr = NetAddr<InetHost>
fn connect_blocking(addr: Self::Addr, timeout: Duration) -> Result<Self>
Source§fn connect_nonblocking(addr: Self::Addr, timeout: Duration) -> Result<Self>
fn connect_nonblocking(addr: Self::Addr, timeout: Duration) -> Result<Self>
Available on crate feature
nonblocking only.Source§fn connect_reusable_nonblocking(
local_addr: Self::Addr,
remote_addr: Self::Addr,
) -> Result<Self>
fn connect_reusable_nonblocking( local_addr: Self::Addr, remote_addr: Self::Addr, ) -> Result<Self>
Available on crate feature
nonblocking only.fn shutdown(&mut self, how: Shutdown) -> Result<()>
fn remote_addr(&self) -> Result<Self::Addr>
fn local_addr(&self) -> Result<Self::Addr>
Source§fn set_tcp_keepalive(&mut self, keepalive: &TcpKeepalive) -> Result<()>
fn set_tcp_keepalive(&mut self, keepalive: &TcpKeepalive) -> Result<()>
Available on crate feature
nonblocking only.fn set_read_timeout(&mut self, dur: Option<Duration>) -> Result<()>
fn set_write_timeout(&mut self, dur: Option<Duration>) -> Result<()>
fn read_timeout(&self) -> Result<Option<Duration>>
fn write_timeout(&self) -> Result<Option<Duration>>
fn peek(&self, buf: &mut [u8]) -> Result<usize>
fn set_nodelay(&mut self, nodelay: bool) -> Result<()>
fn nodelay(&self) -> Result<bool>
fn set_ttl(&mut self, ttl: u32) -> Result<()>
fn ttl(&self) -> Result<u32>
fn set_nonblocking(&mut self, nonblocking: bool) -> Result<()>
fn try_clone(&self) -> Result<TcpStream>
fn take_error(&self) -> Result<Option<Error>>
Source§impl NetConnection for Socket
Available on crate feature socket2 only.
impl NetConnection for Socket
Available on crate feature
socket2 only.type Addr = NetAddr<InetHost>
fn connect_blocking(addr: Self::Addr, timeout: Duration) -> Result<Self>
Source§fn connect_nonblocking(addr: Self::Addr, _timeout: Duration) -> Result<Self>
fn connect_nonblocking(addr: Self::Addr, _timeout: Duration) -> Result<Self>
Available on crate feature
nonblocking only.Source§fn connect_reusable_nonblocking(
local_addr: Self::Addr,
remote_addr: Self::Addr,
) -> Result<Self>
fn connect_reusable_nonblocking( local_addr: Self::Addr, remote_addr: Self::Addr, ) -> Result<Self>
Available on crate feature
nonblocking only.fn shutdown(&mut self, how: Shutdown) -> Result<()>
fn remote_addr(&self) -> Result<Self::Addr>
fn local_addr(&self) -> Result<Self::Addr>
Source§fn set_tcp_keepalive(&mut self, keepalive: &TcpKeepalive) -> Result<()>
fn set_tcp_keepalive(&mut self, keepalive: &TcpKeepalive) -> Result<()>
Available on crate feature
nonblocking only.