pub struct ServerHandle { /* private fields */ }Expand description
The handle to a server being served, which is what owns it on behalf of its caller.
A server ends by being stopped, see Server::stop, by its owner or by a client
through the Kill command of its admin device, and by its handle being waited for,
see Self::wait, which is what deletes its devices. A handle is always waited for:
dropping one drops the server as it stands, with no side effect, see Drop.
Implementations§
Source§impl ServerHandle
impl ServerHandle
pub fn server(&self) -> &Server
Sourcepub fn wait(&self) -> Result<()>
pub fn wait(&self) -> Result<()>
Wait for the server to be stopped, see Server::stop, and its devices deleted,
which is what the thread running a server spends its life in. The first error met
deleting a model is given back.
This blocks, see Self::wait_async for what does not, and Self::wait_timeout
for a wait that gives up.
Sourcepub fn wait_timeout(&self, timeout: Duration) -> Result<()>
pub fn wait_timeout(&self, timeout: Duration) -> Result<()>
Wait for the server to be stopped and its devices deleted, see Self::wait, giving
up with ErrorKind::TimedOut if the backend is still answering requests once the
timeout has run out, which a request that never ends makes it.
The timeout only bounds the backend: once it holds nothing of the devices anymore,
their models are all deleted, however long that takes. A wait that gave up deletes
nothing, a request still running being one that may still use its model, and the
handle is then waited for again, or dropped, which ends everything at once, see
Drop.
Sourcepub async fn wait_async(&self) -> Result<()>
pub async fn wait_async(&self) -> Result<()>
Wait for the server to be stopped and its devices deleted, see Self::wait.
The backend is waited for first, after which no request is in flight and it holds
nothing of the devices anymore, see BackendServer::wait, then the model of every
device is deleted, in the reverse order of their classes, the admin device last.
This never runs on the executor of the backend, which it would wait for.
Trait Implementations§
Source§impl Debug for ServerHandle
impl Debug for ServerHandle
Source§impl Drop for ServerHandle
impl Drop for ServerHandle
Source§fn drop(&mut self)
fn drop(&mut self)
Break the ownership cycles of the server, see Server::clear, and drop its
backend, with no side effect: a server that was not waited for, see
Self::wait, is not unexported, the requests in flight are not answered, and the
models are not deleted, see BackendServer.