[][src]Struct mpris::TrackID

pub struct TrackID(_);

Represents the MPRIS Track_Id type.

use mpris::TrackID;
let no_track = TrackID::new("/org/mpris/MediaPlayer2/TrackList/NoTrack").unwrap();

TrackIDs must be valid D-Bus object paths according to the spec.

Errors

Trying to construct a TrackID from a string that is not a valid D-Bus Path will fail.

let result = TrackID::new("invalid track ID");
assert!(result.is_err());

Methods

impl TrackID[src]

pub fn new<S: Into<String>>(id: S) -> Result<Self, String>[src]

Create a new TrackID from a string-like entity.

This is not something you should normally do as the IDs are temporary and will only work if the Player knows about it.

However, creating TrackIDs manually can help with test setup, comparisons, etc.

Example

use mpris::TrackID;
let id = TrackID::new("/dbus/path/id").expect("Parse error");

pub fn no_track() -> Self[src]

Return a new TrackID that matches the MPRIS standard for the "No track" sentinel value.

Some APIs takes this in order to signal a missing value for a track, for example by saying that no specific track is playing, or that a track should be added at the start of the list instead of after a specific track.

The actual path is "/org/mpris/MediaPlayer2/TrackList/NoTrack".

This value is only valid in some cases. Make sure to read the MPRIS specification before you use this manually.

pub fn as_str(&self) -> &str[src]

Returns a &str variant of the ID.

Trait Implementations

impl Eq for TrackID[src]

impl Clone for TrackID[src]

fn clone_from(&mut self, source: &Self)
1.0.0
[src]

Performs copy-assignment from source. Read more

impl PartialEq<TrackID> for TrackID[src]

impl<'a> From<Path<'a>> for TrackID[src]

impl<'a> From<&'a TrackID> for TrackID[src]

impl From<TrackID> for String[src]

impl<'a> From<&'a TrackID> for Path<'a>[src]

impl Hash for TrackID[src]

fn hash_slice<H>(data: &[Self], state: &mut H) where
    H: Hasher
1.3.0
[src]

Feeds a slice of this type into the given [Hasher]. Read more

impl FromIterator<TrackID> for TrackList[src]

impl Debug for TrackID[src]

impl Display for TrackID[src]

Auto Trait Implementations

impl Send for TrackID

impl Sync for TrackID

Blanket Implementations

impl<T, U> Into for T where
    U: From<T>, 
[src]

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

impl<T> ToString for T where
    T: Display + ?Sized
[src]

impl<T> From for T[src]

impl<T, U> TryFrom for T where
    U: Into<T>, 
[src]

type Error = !

🔬 This is a nightly-only experimental API. (try_from)

The type returned in the event of a conversion error.

impl<T> Borrow for T where
    T: ?Sized
[src]

impl<T, U> TryInto for T where
    U: TryFrom<T>, 
[src]

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

🔬 This is a nightly-only experimental API. (try_from)

The type returned in the event of a conversion error.

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> BorrowMut for T where
    T: ?Sized
[src]