ProgressClone

Struct ProgressClone 

Source
pub struct ProgressClone { /* private fields */ }
Expand description

Used Because Cloning Progress is impossible, making crate::progress::ProgressStream impossible for me to implement

Implementations§

Source§

impl ProgressClone

Source

pub fn metadata(&self) -> &Metadata

The track metadata at the point in time that this Progress was constructed.

Source

pub fn playback_status(&self) -> PlaybackStatus

The playback status at the point in time that this Progress was constructed.

Source

pub fn shuffle(&self) -> bool

The shuffle status at the point in time that this Progress was constructed.

Source

pub fn loop_status(&self) -> LoopStatus

The loop status at the point in time that this Progress was constructed.

Source

pub fn playback_rate(&self) -> f64

The playback rate at the point in time that this Progress was constructed.

Source

pub fn length(&self) -> Option<Duration>

Returns the length of the current track as a Duration.

Source

pub fn position(&self) -> Duration

Returns the current position of the current track as a Duration.

This method will calculate the expected position of the track at the instant of the invocation using the initial_position and knowledge of how long ago that position was determined.

Note: Some players might not support this and will return a bad position. Spotify is one such example. There is no reliable way of detecting problematic players, so it will be up to your client to check for this.

One way of doing this is to query the initial_position for two measures with the PlaybackStatus::Playing and if both are 0, then it is likely that this client does not support positions.

Source

pub fn initial_position(&self) -> Duration

Returns the position that the current track was at when the Progress was created.

This is the number that was returned for the Position property in the MPRIS2 interface.

Source

pub fn created_at(&self) -> &Instant

The instant where this Progress was recorded.

See: age.

Source

pub fn age(&self) -> Duration

Returns the age of the data as a Duration.

If the Progress has a high age it is more likely to be out of date.

Source

pub fn current_volume(&self) -> f64

Returns the player’s volume as it was at the time of refresh.

See: Player::get_volume.

Trait Implementations§

Source§

impl Clone for ProgressClone

Source§

fn clone(&self) -> ProgressClone

Returns a duplicate of the value. Read more
1.0.0 · Source§

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

Performs copy-assignment from source. Read more

Auto Trait Implementations§

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, 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 = 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 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.