pub struct Server { /* private fields */ }Expand description
A running server. Dropping it stops it (with a drain), so keep it and call
Server::wait_for_stop to run until a stop is requested.
Implementations§
Source§impl Server
impl Server
Sourcepub fn open_door(&self) -> Result<(), NetError>
pub fn open_door(&self) -> Result<(), NetError>
Starts accepting on every listener; a second call is a no-op.
§Errors
ShuttingDown while draining or after shutdown; ForkedChild.
Sourcepub fn close_door(&self)
pub fn close_door(&self)
Stops accepting within one loop iteration; listening sockets stay open. Idempotent.
Sourcepub fn drain(&self, deadline: Instant) -> DrainReport
pub fn drain(&self, deadline: Instant) -> DrainReport
Closes the door, tells sessions to finish, closes idle connections at once,
waits for the rest until deadline, then kills them with DrainDeadline.
Sourcepub fn shutdown(self, deadline: Instant) -> DrainReport
pub fn shutdown(self, deadline: Instant) -> DrainReport
Drains, then closes the listening sockets and joins every thread.
Sourcepub fn wait_for_stop(self) -> DrainReport
pub fn wait_for_stop(self) -> DrainReport
Blocks until a stop is requested (ServerHandle::request_stop, or the
control line moves to Draining or Stopping), then shuts down.
Sourcepub fn handle(&self) -> ServerHandle
pub fn handle(&self) -> ServerHandle
A cloneable handle for other threads.
Sourcepub fn listeners(&self) -> &[ListenerInfo]
pub fn listeners(&self) -> &[ListenerInfo]
Facts about each listener.
Trait Implementations§
Auto Trait Implementations§
impl !RefUnwindSafe for Server
impl !UnwindSafe for Server
impl Freeze for Server
impl Send for Server
impl Sync for Server
impl Unpin for Server
impl UnsafeUnpin 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