pub struct ServerState { /* private fields */ }Expand description
Manages server state common to all transport implementations.
Transports are shared rather than owned exclusively, so that an outbound
request can be served from a clone while the engine goes on handling other
commands. That rules out &mut self, so the mutable parts live behind a
lock. It is a std mutex deliberately: every critical section here is a
few field assignments with no await inside, so an async mutex would buy
nothing and cost a scheduling point.
Implementations§
Source§impl ServerState
impl ServerState
Sourcepub fn is_running(&self) -> bool
pub fn is_running(&self) -> bool
Check if the server is currently running.
Sourcepub fn get_address(&self) -> Result<String, SyncError>
pub fn get_address(&self) -> Result<String, SyncError>
Get the server address if available.
Sourcepub fn stop_server(&self)
pub fn stop_server(&self)
Stop the server by triggering shutdown and clearing state. This combines the commonly used pair: trigger_shutdown + set_stopped.
Trait Implementations§
Auto Trait Implementations§
impl !Freeze for ServerState
impl RefUnwindSafe for ServerState
impl Send for ServerState
impl Sync for ServerState
impl Unpin for ServerState
impl UnsafeUnpin for ServerState
impl UnwindSafe for ServerState
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
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§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>
Converts
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>
Converts
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