Struct distant_net::client::ConnectionWatcher
source · pub struct ConnectionWatcher(_);Expand description
Represents a watcher over a ConnectionState.
Implementations
sourceimpl ConnectionWatcher
impl ConnectionWatcher
sourcepub async fn next(&mut self) -> Option<ConnectionState>
pub async fn next(&mut self) -> Option<ConnectionState>
Returns next ConnectionState after a change is detected, or None if no more changes
will be detected.
sourcepub fn has_changed(&self) -> bool
pub fn has_changed(&self) -> bool
Returns true if the connection state has changed.
sourcepub fn last(&self) -> ConnectionState
pub fn last(&self) -> ConnectionState
Returns the last ConnectionState observed.
sourcepub fn on_change<F>(&self, f: F) -> JoinHandle<()>where
F: FnMut(ConnectionState) + Send + 'static,
pub fn on_change<F>(&self, f: F) -> JoinHandle<()>where
F: FnMut(ConnectionState) + Send + 'static,
Spawns a new task that continually monitors for connection state changes and invokes the
function f whenever a new change is detected.
Trait Implementations
sourceimpl Clone for ConnectionWatcher
impl Clone for ConnectionWatcher
sourcefn clone(&self) -> ConnectionWatcher
fn clone(&self) -> ConnectionWatcher
Returns a copy of the value. Read more
1.0.0 · sourcefn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreAuto Trait Implementations
impl !RefUnwindSafe for ConnectionWatcher
impl Send for ConnectionWatcher
impl Sync for ConnectionWatcher
impl Unpin for ConnectionWatcher
impl !UnwindSafe for ConnectionWatcher
Blanket Implementations
sourceimpl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more