pub struct TcpServer<H: NetworkHandler> { /* private fields */ }Expand description
High-level TCP server
Implementations§
Source§impl<H: NetworkHandler> TcpServer<H>
impl<H: NetworkHandler> TcpServer<H>
pub fn new(config: TcpServerConfig, handler: H) -> Result<Self>
Sourcepub fn local_addr(&self) -> Result<SocketAddr>
pub fn local_addr(&self) -> Result<SocketAddr>
Get the local address the server is bound to
Sourcepub fn start(
self: Arc<Self>,
event_loop: &Arc<EventLoop>,
listener_token: Token,
) -> Result<()>
pub fn start( self: Arc<Self>, event_loop: &Arc<EventLoop>, listener_token: Token, ) -> Result<()>
Start the server by registering with the event loop
Sourcepub fn connection_count(&self) -> usize
pub fn connection_count(&self) -> usize
Get active connection count
Auto Trait Implementations§
impl<H> Freeze for TcpServer<H>
impl<H> !RefUnwindSafe for TcpServer<H>
impl<H> Send for TcpServer<H>
impl<H> Sync for TcpServer<H>
impl<H> Unpin for TcpServer<H>
impl<H> UnsafeUnpin for TcpServer<H>
impl<H> !UnwindSafe for TcpServer<H>
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