pub struct TcpListener { /* private fields */ }Expand description
A TCP socket server, listening for connections
Implementations§
Source§impl TcpListener
impl TcpListener
Sourcepub fn new(io: TokioTcpListener) -> Self
pub fn new(io: TokioTcpListener) -> Self
Initialised a new TcpListener
Sourcepub async fn accept(&self) -> Result<(TcpStream, SocketAddr)>
pub async fn accept(&self) -> Result<(TcpStream, SocketAddr)>
Accepts an new incoming connection from the listener
Sourcepub fn get_ref(&self) -> &TokioTcpListener
pub fn get_ref(&self) -> &TokioTcpListener
Retruns the reference for the internal listener
Auto Trait Implementations§
impl !Freeze for TcpListener
impl RefUnwindSafe for TcpListener
impl Send for TcpListener
impl Sync for TcpListener
impl Unpin 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