pub struct PortWatcher { /* private fields */ }Expand description
A PortWatcher caches listening-socket scans for a short TTL and can be
injected with a mock scanner in tests.
Implementations§
Source§impl PortWatcher
impl PortWatcher
Sourcepub fn with_scanner(
ttl: Duration,
scanner: Box<dyn Fn() -> Vec<(u16, u32, String)> + Send + Sync>,
) -> Self
pub fn with_scanner( ttl: Duration, scanner: Box<dyn Fn() -> Vec<(u16, u32, String)> + Send + Sync>, ) -> Self
A watcher with an explicit scan function (used by tests).
Sourcepub fn check(&self, ports_to_check: &[u16]) -> Vec<PortStatus>
pub fn check(&self, ports_to_check: &[u16]) -> Vec<PortStatus>
Returns PortStatus for every requested port that is occupied,
re-scanning when any requested port is missing or stale.
Trait Implementations§
Auto Trait Implementations§
impl !Freeze for PortWatcher
impl !RefUnwindSafe for PortWatcher
impl !UnwindSafe for PortWatcher
impl Forget for PortWatcher
impl Send for PortWatcher
impl Sync for PortWatcher
impl Unpin for PortWatcher
impl UnsafeUnpin for PortWatcher
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