pub struct Server { /* private fields */ }
Expand description
Represents a server which manages all TCP connections.
Implementations§
source§impl Server
impl Server
sourcepub fn install(platform: &Arc<Platform>) -> Arc<Self>
pub fn install(platform: &Arc<Platform>) -> Arc<Self>
Creates and installs a Server into the given Platform.
Note that this is called by the Builder unless disabled.
Also note, that this will not technically start the server. This has to be done manually via event_loop as it is most probable done in the main thread.
sourcepub fn connections(&self) -> Vec<ConnectionInfo>
pub fn connections(&self) -> Vec<ConnectionInfo>
Lists all currently active connections.
sourcepub fn fork(server: &Arc<Server>)
pub fn fork(server: &Arc<Server>)
Starts the event loop in a separate thread.
This is most probably used by test scenarios where the tests itself run in the main thread.
sourcepub async fn fork_and_await(server: &Arc<Server>)
pub async fn fork_and_await(server: &Arc<Server>)
Starts the event loop in a separate thread and waits until the server is up and running.
Just like fork this is intended to be used in test environments.
sourcepub async fn event_loop(&self)
pub async fn event_loop(&self)
Tries to open a server socket on the specified address to serve incoming client connections.
The task of this loop is to bind the server socket to the specified address. Once this was successful, we enter the server_loop to actually handle incoming connections. Once this loop returns, either the platform is no longer running and we should exit, or the config has changed and we should try to bind the server to the new address.
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
source§impl<T> Instrument for T
impl<T> Instrument for T
source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
source§impl<T> IntoEither for T
impl<T> IntoEither for T
source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self
into a Left
variant of Either<Self, Self>
if into_left
is true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read moresource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self
into a Left
variant of Either<Self, Self>
if into_left(&self)
returns true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read more