pub enum PlayContextId<'a> {
    Artist(ArtistId<'a>),
    Album(AlbumId<'a>),
    Playlist(PlaylistId<'a>),
    Show(ShowId<'a>),
}
Expand description

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

Variants§

§

Artist(ArtistId<'a>)

§

Album(AlbumId<'a>)

§

Playlist(PlaylistId<'a>)

§

Show(ShowId<'a>)

Implementations§

source§

impl<'a> PlayContextId<'a>

source

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

source

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

source

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

Trait Implementations§

source§

impl<'a> From<AlbumId<'a>> for PlayContextId<'a>

source§

fn from(v: AlbumId<'a>) -> PlayContextId<'a>

Converts to this type from the input type.
source§

impl<'a> From<ArtistId<'a>> for PlayContextId<'a>

source§

fn from(v: ArtistId<'a>) -> PlayContextId<'a>

Converts to this type from the input type.
source§

impl<'a> From<PlaylistId<'a>> for PlayContextId<'a>

source§

fn from(v: PlaylistId<'a>) -> PlayContextId<'a>

Converts to this type from the input type.
source§

impl<'a> From<ShowId<'a>> for PlayContextId<'a>

source§

fn from(v: ShowId<'a>) -> PlayContextId<'a>

Converts to this type from the input type.
source§

impl<'a> Id for PlayContextId<'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<AlbumId<'a>> for PlayContextId<'a>

§

type Error = &'static str

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

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

Performs the conversion.
source§

impl<'a> TryInto<ArtistId<'a>> for PlayContextId<'a>

§

type Error = &'static str

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

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

Performs the conversion.
source§

impl<'a> TryInto<PlaylistId<'a>> for PlayContextId<'a>

§

type Error = &'static str

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

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

Performs the conversion.
source§

impl<'a> TryInto<ShowId<'a>> for PlayContextId<'a>

§

type Error = &'static str

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

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

Performs the conversion.

Auto Trait Implementations§

§

impl<'a> Freeze for PlayContextId<'a>

§

impl<'a> RefUnwindSafe for PlayContextId<'a>

§

impl<'a> Send for PlayContextId<'a>

§

impl<'a> Sync for PlayContextId<'a>

§

impl<'a> Unpin for PlayContextId<'a>

§

impl<'a> UnwindSafe for PlayContextId<'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.