[−][src]Struct mpris::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 TrackID
s 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(&self) -> 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<__H: Hasher>(&self, state: &mut __H)
[src]
fn hash_slice<H>(data: &[Self], state: &mut H) where
H: Hasher,
1.3.0[src]
H: Hasher,
Feeds a slice of this type into the given [Hasher
]. Read more
impl FromIterator<TrackID> for TrackList
[src]
fn from_iter<I: IntoIterator<Item = TrackID>>(iter: I) -> Self
[src]
impl Debug for TrackID
[src]
impl Display for TrackID
[src]
Auto Trait Implementations
Blanket Implementations
impl<T, U> Into for T where
U: From<T>,
[src]
U: From<T>,
impl<T> ToOwned for T where
T: Clone,
[src]
T: Clone,
impl<T> ToString for T where
T: Display + ?Sized,
[src]
T: Display + ?Sized,
impl<T> From for T
[src]
impl<T, U> TryFrom for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = !
try_from
)The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T> Borrow for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T, U> TryInto for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,
type Error = <U as TryFrom<T>>::Error
try_from
)The type returned in the event of a conversion error.
fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>
[src]
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> BorrowMut for T where
T: ?Sized,
[src]
T: ?Sized,