[][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 Clone for TrackID[src]

impl Debug for TrackID[src]

impl Display for TrackID[src]

impl Eq for TrackID[src]

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

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

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

impl From<TrackID> for String[src]

impl FromIterator<TrackID> for TrackList[src]

impl Hash for TrackID[src]

impl PartialEq<TrackID> for TrackID[src]

impl StructuralEq for TrackID[src]

impl StructuralPartialEq for TrackID[src]

Auto Trait Implementations

impl RefUnwindSafe for TrackID

impl Send for TrackID

impl Sync for TrackID

impl Unpin for TrackID

impl UnwindSafe for TrackID

Blanket Implementations

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

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

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

impl<T> From<T> for T[src]

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

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

type Owned = T

The resulting type after obtaining ownership.

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

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

type Error = Infallible

The type returned in the event of a conversion error.

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

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

The type returned in the event of a conversion error.