pub struct TcpListener { /* private fields */ }Expand description
A TCP socket listener TCP套接字监听器
Listens for incoming connections on a specific address. 在特定地址上监听传入的连接。
Implementations§
Source§impl TcpListener
impl TcpListener
Sourcepub fn bind(addr: &str) -> BindFuture ⓘ
pub fn bind(addr: &str) -> BindFuture ⓘ
Sourcepub fn accept(&mut self) -> AcceptFuture<'_> ⓘ
pub fn accept(&mut self) -> AcceptFuture<'_> ⓘ
Accept a new connection 接受新连接
Sourcepub fn local_addr(&self) -> Result<SocketAddr>
pub fn local_addr(&self) -> Result<SocketAddr>
Get the local address 获取本地地址
Trait Implementations§
Auto Trait Implementations§
impl Freeze for TcpListener
impl RefUnwindSafe for TcpListener
impl Send for TcpListener
impl Sync for TcpListener
impl Unpin for TcpListener
impl UnsafeUnpin for TcpListener
impl UnwindSafe for TcpListener
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