pub struct SystemProfileWatcher { /* private fields */ }Expand description
Watcher for dynamic hardware changes.
Uses polling on all platforms (inotify/FSEvents/ReadDirectoryChanges are future work) with a configurable interval.
Implementations§
Source§impl SystemProfileWatcher
impl SystemProfileWatcher
Sourcepub fn new(poll_interval: Duration) -> Self
pub fn new(poll_interval: Duration) -> Self
Create a new watcher with the given polling interval.
The initial system profile is detected immediately.
Sourcepub fn subscribe(&self) -> Receiver<ProfileChange>
pub fn subscribe(&self) -> Receiver<ProfileChange>
Get a receiver for change events.
The receiver will immediately receive the current profile snapshot.
Sourcepub fn current_profile(&self) -> Option<Arc<SystemProfile>>
pub fn current_profile(&self) -> Option<Arc<SystemProfile>>
Get the most recently detected profile (blocking, fast).
Sourcepub fn start_background(self: &Arc<Self>) -> JoinHandle<()> ⓘ
pub fn start_background(self: &Arc<Self>) -> JoinHandle<()> ⓘ
Start the background polling loop. Runs until the returned handle is dropped.
Auto Trait Implementations§
impl !RefUnwindSafe for SystemProfileWatcher
impl !UnwindSafe for SystemProfileWatcher
impl Freeze for SystemProfileWatcher
impl Send for SystemProfileWatcher
impl Sync for SystemProfileWatcher
impl Unpin for SystemProfileWatcher
impl UnsafeUnpin for SystemProfileWatcher
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
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