pub struct MprisPoller {
state: Arc<Mutex<MprisSnapshot>>,
stop: Arc<AtomicBool>,
}Expand description
Background MPRIS2 progress reader.
Polling on a dedicated thread avoids the per-frame D-Bus latency
(a couple ms per round-trip on a quiet desktop, much worse if a
player is slow to respond). The engine consumes the snapshot
through MprisPoller::snapshot each frame; the call is a cheap
Mutex lock + clone.
Fields§
§state: Arc<Mutex<MprisSnapshot>>§stop: Arc<AtomicBool>Implementations§
Source§impl MprisPoller
impl MprisPoller
Sourcepub fn spawn() -> Option<Self>
pub fn spawn() -> Option<Self>
Spawn the background poller. Returns None when the D-Bus
session bus isn’t reachable (headless CI, sandbox without bus
access, …) so the caller can fall back to the local-window
progress instead of paying for a poller that will never
produce a useful snapshot.
Sourcepub fn snapshot(&self) -> MprisSnapshot
pub fn snapshot(&self) -> MprisSnapshot
Current snapshot. Cheap (mutex lock + clone, no D-Bus traffic).
Trait Implementations§
Auto Trait Implementations§
impl Freeze for MprisPoller
impl RefUnwindSafe for MprisPoller
impl Send for MprisPoller
impl Sync for MprisPoller
impl Unpin for MprisPoller
impl UnwindSafe for MprisPoller
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<S> FromSample<S> for S
impl<S> FromSample<S> for S
fn from_sample_(s: S) -> S
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