Skip to main content

Player

Struct Player 

Source
pub struct Player {
Show 21 fields pub id: String, pub identity: String, pub desktop_entry: String, pub status: PlaybackStatus, pub title: String, pub artists: Vec<String>, pub album: String, pub art_url: String, pub length: Option<Duration>, pub can_play: bool, pub can_pause: bool, pub can_go_next: bool, pub can_go_previous: bool, pub can_seek: bool, pub can_control: bool, pub volume: Option<f64>, pub shuffle: Option<bool>, pub loop_status: Option<LoopStatus>, pub rate: f64, pub position: Duration, pub position_known_at: Instant,
}
Expand description

A media player and its track, as MPRIS describes them. Text is cut to 4 KiB.

Fields§

§id: String

Its bus name, such as org.mpris.MediaPlayer2.vlc, unique while it runs. The key to give children_keyed, and what Mpris::play_pause and the rest take.

§identity: String

Its name for people, such as VLC media player.

§desktop_entry: String

Its desktop file’s name without .desktop, such as vlc, or "".

§status: PlaybackStatus

Whether it plays.

§title: String

The track’s title, or "".

§artists: Vec<String>

The track’s artists, at most 32.

§album: String

The track’s album, or "".

§art_url: String

Where the track’s cover art is, such as a file:// URL, or "".

§length: Option<Duration>

How long the track is, if the player says.

§can_play: bool

Whether Mpris::play would do anything.

§can_pause: bool

Whether Mpris::pause would do anything.

§can_go_next: bool

Whether Mpris::next would do anything.

§can_go_previous: bool

Whether Mpris::previous would do anything.

§can_seek: bool

Whether Mpris::seek and Mpris::set_position would do anything.

§can_control: bool

Whether it can be controlled at all.

§volume: Option<f64>

Its volume, 1.0 for full, if it has one.

§shuffle: Option<bool>

Whether it shuffles, if it can.

§loop_status: Option<LoopStatus>

What it does at the end, if it can loop.

§rate: f64

How fast it plays, 1.0 for normal speed.

§position: Duration

Where playback was at position_known_at.

§position_known_at: Instant

When position was read.

Implementations§

Source§

impl Player

Source

pub fn position_at(&self, now: Instant) -> Duration

Where playback is at now: position, moved on at rate since it was read while the player plays, and never past the track’s length. A bar that shows it ticking calls this from a clock of its own.

Trait Implementations§

Source§

impl Clone for Player

Source§

fn clone(&self) -> Self

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for Player

Source§

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

Formats the value using the given formatter. Read more
Source§

impl PartialEq for Player

Source§

fn eq(&self, other: &Self) -> bool

Equality operator ==. Read more
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Inequality operator !=. Read more
Source§

impl StructuralPartialEq for Player

Auto Trait Implementations§

§

impl Forget for Player

§

impl Freeze for Player

§

impl Move for Player

§

impl RefUnwindSafe for Player

§

impl Send for Player

§

impl Sync for Player

§

impl Unpin for Player

§

impl UnsafeUnpin for Player

§

impl UnwindSafe for Player

Blanket Implementations§

Source§

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

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

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

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

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

Source§

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

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self> ⓘ

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self> ⓘ

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where 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> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

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

Source§

type Error = !

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

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

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

Source§

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.
Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self> ⓘ
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self> ⓘ

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more