pub struct ConnectionWatcher(/* private fields */);
Expand description
Represents a watcher over a ConnectionState
.
Implementations§
Source§impl 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<()>
pub fn on_change<F>(&self, f: F) -> JoinHandle<()>
Spawns a new task that continually monitors for connection state changes and invokes the
function f
whenever a new change is detected.
Trait Implementations§
Source§impl Clone for ConnectionWatcher
impl Clone for ConnectionWatcher
Source§fn clone(&self) -> ConnectionWatcher
fn clone(&self) -> ConnectionWatcher
Returns a duplicate of the value. Read more
1.0.0 · Source§const fn clone_from(&mut self, source: &Self)
const fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source
. Read moreAuto Trait Implementations§
impl Freeze for ConnectionWatcher
impl !RefUnwindSafe for ConnectionWatcher
impl Send for ConnectionWatcher
impl Sync for ConnectionWatcher
impl Unpin for ConnectionWatcher
impl !UnwindSafe for ConnectionWatcher
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