Struct librespot_core::spotify_id::SpotifyId[][src]

pub struct SpotifyId {
    pub id: u128,
    pub audio_type: SpotifyAudioType,
}

Fields

id: u128audio_type: SpotifyAudioType

Implementations

impl SpotifyId[src]

pub fn from_base16(src: &str) -> Result<SpotifyId, SpotifyIdError>[src]

Parses a base16 (hex) encoded Spotify ID into a SpotifyId.

src is expected to be 32 bytes long and encoded using valid characters.

pub fn from_base62(src: &str) -> Result<SpotifyId, SpotifyIdError>[src]

Parses a base62 encoded Spotify ID into a SpotifyId.

src is expected to be 22 bytes long and encoded using valid characters.

pub fn from_raw(src: &[u8]) -> Result<SpotifyId, SpotifyIdError>[src]

Creates a SpotifyId from a copy of SpotifyId::SIZE (16) bytes in big-endian order.

The resulting SpotifyId will default to a SpotifyAudioType::TRACK.

pub fn from_uri(src: &str) -> Result<SpotifyId, SpotifyIdError>[src]

Parses a Spotify URI into a SpotifyId.

uri is expected to be in the canonical form spotify:{type}:{id}, where {type} can be arbitrary while {id} is a 22-character long, base62 encoded Spotify ID.

pub fn to_base16(&self) -> String[src]

Returns the SpotifyId as a base16 (hex) encoded, SpotifyId::SIZE_BASE62 (22) character long String.

pub fn to_base62(&self) -> String[src]

Returns the SpotifyId as a canonically base62 encoded, SpotifyId::SIZE_BASE62 (22) character long String.

pub fn to_raw(&self) -> [u8; 16][src]

Returns a copy of the SpotifyId as an array of SpotifyId::SIZE (16) bytes in big-endian order.

pub fn to_uri(&self) -> String[src]

Returns the SpotifyId 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 SpotifyId has an associated type unrecognized by the library, {type} will be encoded as unknown.

Trait Implementations

impl Clone for SpotifyId[src]

impl Copy for SpotifyId[src]

impl Debug for SpotifyId[src]

impl Eq for SpotifyId[src]

impl Hash for SpotifyId[src]

impl PartialEq<SpotifyId> for SpotifyId[src]

impl StructuralEq for SpotifyId[src]

impl StructuralPartialEq for SpotifyId[src]

Auto Trait Implementations

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<Q, K> Equivalent<K> for Q where
    K: Borrow<Q> + ?Sized,
    Q: Eq + ?Sized
[src]

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

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

impl<T> Same<T> for T

type Output = T

Should always be Self

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

type Owned = T

The resulting type after obtaining ownership.

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.

impl<V, T> VZip<V> for T where
    V: MultiLane<T>,