pub enum SpotifyUri {
Album {
id: SpotifyId,
},
Artist {
id: SpotifyId,
},
Episode {
id: SpotifyId,
},
Playlist {
user: Option<String>,
id: SpotifyId,
},
Show {
id: SpotifyId,
},
Track {
id: SpotifyId,
},
Local {
artist: String,
album_title: String,
track_title: String,
duration: Duration,
},
Unknown {
kind: Cow<'static, str>,
id: String,
},
}Variants§
Implementations§
Source§impl SpotifyUri
impl SpotifyUri
Sourcepub fn is_playable(&self) -> bool
pub fn is_playable(&self) -> bool
Returns whether this SpotifyUri is for a playable audio item, if known.
Sourcepub fn to_id(&self) -> Result<String, Error>
pub fn to_id(&self) -> Result<String, Error>
Gets the ID of this URI. The resource ID is the component of the URI that identifies
the resource after its type label. If self is a named ID, the user will be omitted.
Sourcepub fn from_uri(src: &str) -> SpotifyUriResult
pub fn from_uri(src: &str) -> SpotifyUriResult
Parses a [Spotify URI] into a SpotifyUri.
uri is expected to be in the canonical form spotify:{type}:{id}, where {type}
can be arbitrary while {id} is in a format that varies based on the {type}:
- For most item types, a 22-character long, base62 encoded Spotify ID is expected.
- For local files, an arbitrary length string with the fields
{artist}:{album_title}:{track_title}:{duration_in_seconds}is expected.
Spotify URI: https://developer.spotify.com/documentation/web-api/concepts/spotify-uris-ids
Sourcepub fn to_uri(&self) -> Result<String, Error>
pub fn to_uri(&self) -> Result<String, Error>
Returns the SpotifyUri as a Spotify URI in the canonical form spotify:{type}:{id},
where {type} is an arbitrary string and {id} is a 22-character long, base62 encoded
Spotify ID.
If the SpotifyUri has an associated type unrecognized by the library, {type} will
be encoded as unknown.
If the SpotifyUri is named, it will be returned in the form
spotify:user:{user}:{type}:{id}.
Sourcepub fn to_base62(&self) -> Result<String, Error>
👎Deprecated since 0.8.0: use to_name instead
pub fn to_base62(&self) -> Result<String, Error>
Gets the name of this URI. The resource name is the component of the URI that identifies
the resource after its type label. If self is a named ID, the user will be omitted.
Deprecated: not all IDs can be represented in Base62, so this function has been renamed to SpotifyUri::to_id, which this implementation forwards to.
Trait Implementations§
Source§impl Clone for SpotifyUri
impl Clone for SpotifyUri
Source§fn clone(&self) -> SpotifyUri
fn clone(&self) -> SpotifyUri
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for SpotifyUri
impl Debug for SpotifyUri
Source§impl Display for SpotifyUri
impl Display for SpotifyUri
Source§impl Hash for SpotifyUri
impl Hash for SpotifyUri
Source§impl PartialEq for SpotifyUri
impl PartialEq for SpotifyUri
Source§impl TryFrom<&Album> for SpotifyUri
impl TryFrom<&Album> for SpotifyUri
Source§impl TryFrom<&Artist> for SpotifyUri
impl TryFrom<&Artist> for SpotifyUri
Source§impl TryFrom<&ArtistWithRole> for SpotifyUri
impl TryFrom<&ArtistWithRole> for SpotifyUri
Source§impl TryFrom<&Episode> for SpotifyUri
impl TryFrom<&Episode> for SpotifyUri
Source§impl TryFrom<&Item> for SpotifyUri
impl TryFrom<&Item> for SpotifyUri
Source§impl TryFrom<&MetaItem> for SpotifyUri
impl TryFrom<&MetaItem> for SpotifyUri
Source§impl TryFrom<&SelectedListContent> for SpotifyUri
impl TryFrom<&SelectedListContent> for SpotifyUri
Source§impl TryFrom<&Show> for SpotifyUri
impl TryFrom<&Show> for SpotifyUri
Source§impl TryFrom<&SpotifyUri> for SpotifyId
impl TryFrom<&SpotifyUri> for SpotifyId
Source§impl TryFrom<&Track> for SpotifyUri
impl TryFrom<&Track> for SpotifyUri
Source§impl TryFrom<&TranscodedPicture> for SpotifyUri
impl TryFrom<&TranscodedPicture> for SpotifyUri
impl Eq for SpotifyUri
impl StructuralPartialEq for SpotifyUri
Auto Trait Implementations§
impl Freeze for SpotifyUri
impl RefUnwindSafe for SpotifyUri
impl Send for SpotifyUri
impl Sync for SpotifyUri
impl Unpin for SpotifyUri
impl UnwindSafe for SpotifyUri
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> PolicyExt for Twhere
T: ?Sized,
impl<T> PolicyExt for Twhere
T: ?Sized,
Source§impl<T> ToStringFallible for Twhere
T: Display,
impl<T> ToStringFallible for Twhere
T: Display,
Source§fn try_to_string(&self) -> Result<String, TryReserveError>
fn try_to_string(&self) -> Result<String, TryReserveError>
ToString::to_string, but without panic on OOM.