pub enum PlayableId<'a> {
    Track(TrackId<'a>),
    Episode(EpisodeId<'a>),
}
Expand description

Grouping up multiple kinds of IDs to treat them generically. This also implements Id and From to instantiate it.

Variants§

§

Track(TrackId<'a>)

§

Episode(EpisodeId<'a>)

Implementations§

source§

impl<'a> PlayableId<'a>

source

pub fn as_ref(&'a self) -> PlayableId<'a>

source

pub fn into_static(self) -> PlayableId<'static>

source

pub fn clone_static(&'a self) -> PlayableId<'static>

Trait Implementations§

source§

impl<'a> From<EpisodeId<'a>> for PlayableId<'a>

source§

fn from(v: EpisodeId<'a>) -> PlayableId<'a>

Converts to this type from the input type.
source§

impl<'a> From<TrackId<'a>> for PlayableId<'a>

source§

fn from(v: TrackId<'a>) -> PlayableId<'a>

Converts to this type from the input type.
source§

impl<'a> Id for PlayableId<'a>

source§

fn id(&self) -> &str

Returns the inner Spotify object ID, which is guaranteed to be valid for its type.

source§

fn _type(&self) -> Type

The type of the ID, as a function.

source§

fn uri(&self) -> String

Returns a Spotify object URI in a well-known format: spotify:type:id.

Examples: spotify:album:6IcGNaXFRf5Y1jc7QsE9O2, spotify:track:4y4VO05kYgUTo2bzbox1an.

source§

fn url(&self) -> String

Returns a full Spotify object URL that can be opened in a browser.

Examples: https://open.spotify.com/track/4y4VO05kYgUTo2bzbox1an, https://open.spotify.com/artist/2QI8e2Vwgg9KXOz2zjcrkI.

source§

impl<'a> TryInto<EpisodeId<'a>> for PlayableId<'a>

§

type Error = &'static str

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

fn try_into( self ) -> Result<EpisodeId<'a>, <PlayableId<'a> as TryInto<EpisodeId<'a>>>::Error>

Performs the conversion.
source§

impl<'a> TryInto<TrackId<'a>> for PlayableId<'a>

§

type Error = &'static str

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

fn try_into( self ) -> Result<TrackId<'a>, <PlayableId<'a> as TryInto<TrackId<'a>>>::Error>

Performs the conversion.

Auto Trait Implementations§

§

impl<'a> Freeze for PlayableId<'a>

§

impl<'a> RefUnwindSafe for PlayableId<'a>

§

impl<'a> Send for PlayableId<'a>

§

impl<'a> Sync for PlayableId<'a>

§

impl<'a> Unpin for PlayableId<'a>

§

impl<'a> UnwindSafe for PlayableId<'a>

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> 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> Same for T

§

type Output = T

Should always be Self
source§

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

§

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

§

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.