pub struct ConnectionStatusTracker { /* private fields */ }Expand description
Thread-safe wrapper for tracking and updating connection status
Implementations§
Source§impl ConnectionStatusTracker
impl ConnectionStatusTracker
Sourcepub fn new() -> Self
pub fn new() -> Self
Creates a new ConnectionStatusTracker with the initial status set to Disconnected
Sourcepub fn with_status(initial_status: ConnectionStatus) -> Self
pub fn with_status(initial_status: ConnectionStatus) -> Self
Creates a new ConnectionStatusTracker with the specified initial status
Sourcepub fn get_status(&self) -> ConnectionStatus
pub fn get_status(&self) -> ConnectionStatus
Get the current connection status
Sourcepub fn register_listener<L: StatusListener + 'static>(&self, listener: L)
pub fn register_listener<L: StatusListener + 'static>(&self, listener: L)
Register a listener to receive status updates
Sourcepub fn update_status(&self, new_status: ConnectionStatus)
pub fn update_status(&self, new_status: ConnectionStatus)
Update the connection status and notify all listeners
Sourcepub fn create_updater<'a>(&'a self) -> impl Fn(ConnectionStatus) + 'a
pub fn create_updater<'a>(&'a self) -> impl Fn(ConnectionStatus) + 'a
Create a helper closure that can be used to update the status
Sourcepub fn get_inner(&self) -> Arc<RwLock<ConnectionStatus>>
pub fn get_inner(&self) -> Arc<RwLock<ConnectionStatus>>
Get a clone of the inner Arc<RwLock
Trait Implementations§
Source§impl Clone for ConnectionStatusTracker
impl Clone for ConnectionStatusTracker
Source§fn clone(&self) -> ConnectionStatusTracker
fn clone(&self) -> ConnectionStatusTracker
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreAuto Trait Implementations§
impl Freeze for ConnectionStatusTracker
impl RefUnwindSafe for ConnectionStatusTracker
impl Send for ConnectionStatusTracker
impl Sync for ConnectionStatusTracker
impl Unpin for ConnectionStatusTracker
impl UnwindSafe for ConnectionStatusTracker
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