pub struct ReliableTunnelListener { /* private fields */ }Expand description
Listener for accepting reliable tunnel connections.
The listener accepts both KCP (UDP-based) and TCP connections, providing a unified interface for handling incoming connections.
§Examples
while let Ok(tunnel) = listener.accept().await {
tokio::spawn(async move {
// Handle the connection
});
}Implementations§
Source§impl ReliableTunnelListener
impl ReliableTunnelListener
Sourcepub async fn accept(&mut self) -> Result<ReliableTunnel>
pub async fn accept(&mut self) -> Result<ReliableTunnel>
Accepts an incoming reliable tunnel connection.
This method blocks until a connection is available. The connection can be either KCP (UDP-based) or TCP.
§Returns
Returns a ReliableTunnel that can be used for bidirectional communication.
§Examples
loop {
match listener.accept().await {
Ok(tunnel) => {
tokio::spawn(async move {
// Handle the tunnel
});
}
Err(e) => {
eprintln!("Accept error: {}", e);
break;
}
}
}Trait Implementations§
Auto Trait Implementations§
impl !Freeze for ReliableTunnelListener
impl !RefUnwindSafe for ReliableTunnelListener
impl Send for ReliableTunnelListener
impl Sync for ReliableTunnelListener
impl Unpin for ReliableTunnelListener
impl !UnwindSafe for ReliableTunnelListener
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