Struct mpris::PlayerFinder

source ·
pub struct PlayerFinder { /* private fields */ }
Expand description

Used to find Players running on a D-Bus connection.

All find results are sorted in alphabetical order.

Implementations§

source§

impl PlayerFinder

source

pub fn new() -> Result<Self, DBusError>

Creates a new PlayerFinder with a new default D-Bus connection.

Use for_connection if you want to provide the D-Bus connection yourself.

source

pub fn for_connection(connection: Connection) -> Self

Create a new PlayerFinder with the given connection.

Use new if you want a new default connection rather than manually managing the D-Bus connection.

source

pub fn player_timeout_ms(&self) -> i32

Get the current timeout value that all Players created through this finder will inherit

Can be set with set_player_timeout_ms

source

pub fn set_player_timeout_ms(&mut self, timeout_ms: i32)

Set the timeout value that all Players created through this finder will inherit

source

pub fn find_all(&self) -> Result<Vec<Player>, FindingError>

Find all available Players in the connection.

Will return an empty Vec and not NoPlayerFound if there are no players.

source

pub fn find_first(&self) -> Result<Player, FindingError>

Return the first found Player regardless of state.

source

pub fn find_active(&self) -> Result<Player, FindingError>

Try to find the “active” Player in the connection.

This method will try to determine which player a user is most likely to use. First it will look for a player with the playback status Playing, then for a Paused, then one with track metadata, after that it will just return the first it finds. NoPlayerFound is returned only if there is no player on the DBus.

source

pub fn find_by_name(&self, name: &str) -> Result<Player, FindingError>

Find a Player by it’s MPRIS Identity. Returns NoPlayerFound if no direct match found.

source

pub fn iter_players(&self) -> Result<PlayerIter, DBusError>

Returns a PlayerIter iterator, or an DBusError if there was a problem with the D-Bus

For more details see PlayerIter documentation

Trait Implementations§

source§

impl Debug for PlayerFinder

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more

Auto Trait Implementations§

Blanket Implementations§

source§

impl<T> Any for Twhere T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for Twhere T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for Twhere T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T, U> Into<U> for Twhere U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

source§

impl<T, U> TryFrom<U> for Twhere U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for Twhere U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.