Struct protosocket_server::Server
source · pub struct Server { /* private fields */ }
Implementations§
source§impl Server
impl Server
pub fn new() -> Result<Self>
sourcepub fn register_service_listener<Connector: ServerConnector>(
&mut self,
listener: TcpListener,
server_state: Connector,
) -> Result<ConnectionServer<Connector>>
pub fn register_service_listener<Connector: ServerConnector>( &mut self, listener: TcpListener, server_state: Connector, ) -> Result<ConnectionServer<Connector>>
listener must be configured non_blocking
see register_multithreaded_service_listener
for a configuration that has multiple IO drivers for the service.
sourcepub fn register_multithreaded_service_listener<Connector: ServerConnector + Clone>(
&mut self,
listener: TcpListener,
server_state: Connector,
thread_count: usize,
) -> Result<Vec<ConnectionServer<Connector>>>
pub fn register_multithreaded_service_listener<Connector: ServerConnector + Clone>( &mut self, listener: TcpListener, server_state: Connector, thread_count: usize, ) -> Result<Vec<ConnectionServer<Connector>>>
Configure a single tcp listener to vend connections to separate IO drivers (one driver per connection server).
Each of the returned ConnectionServers can be spawned onto distinct threads, and their connections will be segregated. Connections are vended to the backing threads in round-robin fashion. There is no work stealing between the ConnectionServers - they are fully distinct.
ConnectionServers can reuse the same task work pool if desired, or they can use separate async work pools. What works best for you is what you should do.
listener must be configured non_blocking
Auto Trait Implementations§
impl Freeze for Server
impl !RefUnwindSafe for Server
impl Send for Server
impl Sync for Server
impl Unpin for Server
impl !UnwindSafe for Server
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