pub struct MprisHandle { /* private fields */ }Expand description
The widget-side handle to the process’s media controls, started through the
current crate::process::MediaSessionFactory. When the process has none — the
default (non-mpris) build, non-Unix platforms, no session bus, headless
processes — this is an inert stub: publish is a no-op and drain_commands
yields nothing, so the widget code path is identical everywhere.
Implementations§
Source§impl MprisHandle
impl MprisHandle
Sourcepub fn disabled() -> Self
pub fn disabled() -> Self
An inert handle (no D-Bus). Used by the default build, --shots, tests,
and as the graceful fallback when no session bus is reachable.
Sourcepub fn spawn(config: MprisConfig, initial: PlayerSnapshot) -> Self
pub fn spawn(config: MprisConfig, initial: PlayerSnapshot) -> Self
Register a player under config with the current process, publishing
initial as the starting state. Never panics: when the process has no
media controls it returns an inert Self::disabled.
Sourcepub fn drain_commands(&self) -> Vec<MprisCommand>
pub fn drain_commands(&self) -> Vec<MprisCommand>
Drain every pending external control command (non-blocking).
Sourcepub fn publish(&mut self, snap: PlayerSnapshot)
pub fn publish(&mut self, snap: PlayerSnapshot)
Publish the current player state to the process, which for MPRIS emits
PropertiesChanged for whatever changed. Cheap and deduped:
identical/insignificant updates are dropped so the bus isn’t spammed
each frame.
Trait Implementations§
Auto Trait Implementations§
impl !RefUnwindSafe for MprisHandle
impl !Sync for MprisHandle
impl !UnwindSafe for MprisHandle
impl Forget for MprisHandle
impl Freeze for MprisHandlewhere
*mut Counter<Channel<MprisCommand>>: Freeze,
*mut Counter<Channel<MprisCommand>>: Freeze,
*mut Counter<Channel<MprisCommand>>: Freeze,
*const u8 is !null: Freeze,
PhantomData<u8>: Freeze,
*const dyn MediaSessionPublisher is !null: Freeze,
PhantomData<dyn MediaSessionPublisher>: Freeze,
impl Move for MprisHandle
impl Send for MprisHandle
impl Unpin for MprisHandlewhere
*mut Counter<Channel<MprisCommand>>: Unpin,
*mut Counter<Channel<MprisCommand>>: Unpin,
*mut Counter<Channel<MprisCommand>>: Unpin,
*const u8 is !null: Unpin,
Box<dyn MediaSessionPublisher>: Unpin,
impl UnsafeUnpin for MprisHandlewhere
*mut Counter<Channel<MprisCommand>>: UnsafeUnpin,
*mut Counter<Channel<MprisCommand>>: UnsafeUnpin,
*mut Counter<Channel<MprisCommand>>: UnsafeUnpin,
*const u8 is !null: UnsafeUnpin,
PhantomData<u8>: UnsafeUnpin,
*const dyn MediaSessionPublisher is !null: UnsafeUnpin,
PhantomData<dyn MediaSessionPublisher>: UnsafeUnpin,
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
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> ⓘ
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> ⓘ
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