pub struct NetworkMonitor { /* private fields */ }Expand description
Network monitor for detecting interface changes
Implementations§
Source§impl NetworkMonitor
impl NetworkMonitor
Sourcepub fn new(config: NetworkMonitorConfig) -> Self
pub fn new(config: NetworkMonitorConfig) -> Self
Create a new network monitor
Sourcepub fn get_interfaces(&self) -> HashMap<String, NetworkInterface>
pub fn get_interfaces(&self) -> HashMap<String, NetworkInterface>
Get current network interfaces
Sourcepub fn get_primary_interface(&self) -> Option<NetworkInterface>
pub fn get_primary_interface(&self) -> Option<NetworkInterface>
Get the primary (preferred) interface
Sourcepub fn check_for_changes(
&self,
) -> Result<Vec<NetworkChange>, NetworkMonitorError>
pub fn check_for_changes( &self, ) -> Result<Vec<NetworkChange>, NetworkMonitorError>
Check for network changes and return any detected changes
This should be called periodically (e.g., from a background task)
Sourcepub fn stats(&self) -> NetworkMonitorStats
pub fn stats(&self) -> NetworkMonitorStats
Get statistics
Sourcepub fn reset_stats(&self)
pub fn reset_stats(&self)
Reset statistics
Auto Trait Implementations§
impl Freeze for NetworkMonitor
impl !RefUnwindSafe for NetworkMonitor
impl Send for NetworkMonitor
impl Sync for NetworkMonitor
impl Unpin for NetworkMonitor
impl !UnwindSafe for NetworkMonitor
Blanket Implementations§
Source§impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
Source§impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
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
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§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