pub struct ServerState { /* private fields */ }Expand description
Manages server state common to all transport implementations. Since transports are owned exclusively by Sync instances and all operations require &mut self, no internal locking is needed - the Rust ownership system provides the necessary synchronization guarantees.
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 server_started(&mut self, address: String, shutdown_sender: Sender<()>)
pub fn server_started(&mut self, address: String, shutdown_sender: Sender<()>)
Start the server by setting it as running with the given address and shutdown sender. This combines the commonly used pair: set_running + set_shutdown_sender.
Sourcepub fn stop_server(&mut self)
pub fn stop_server(&mut 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 !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> CompatExt for T
impl<T> CompatExt for T
§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