Struct librespot_core::spotify_id::SpotifyId
source · [−]pub struct SpotifyId {
pub id: u128,
pub audio_type: SpotifyAudioType,
}
Fields
id: u128
audio_type: SpotifyAudioType
Implementations
sourceimpl SpotifyId
impl SpotifyId
sourcepub fn from_base16(src: &str) -> Result<SpotifyId, SpotifyIdError>
pub fn from_base16(src: &str) -> Result<SpotifyId, SpotifyIdError>
Parses a base16 (hex) encoded Spotify ID into a SpotifyId
.
src
is expected to be 32 bytes long and encoded using valid characters.
sourcepub fn from_base62(src: &str) -> Result<SpotifyId, SpotifyIdError>
pub fn from_base62(src: &str) -> Result<SpotifyId, SpotifyIdError>
Parses a base62 encoded Spotify ID into a SpotifyId
.
src
is expected to be 22 bytes long and encoded using valid characters.
sourcepub fn from_raw(src: &[u8]) -> Result<SpotifyId, SpotifyIdError>
pub fn from_raw(src: &[u8]) -> Result<SpotifyId, SpotifyIdError>
Creates a SpotifyId
from a copy of SpotifyId::SIZE
(16) bytes in big-endian order.
The resulting SpotifyId
will default to a SpotifyAudioType::TRACK
.
sourcepub fn from_uri(src: &str) -> Result<SpotifyId, SpotifyIdError>
pub fn from_uri(src: &str) -> Result<SpotifyId, SpotifyIdError>
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.
sourcepub fn to_base16(&self) -> Result<String, FromUtf8Error>
pub fn to_base16(&self) -> Result<String, FromUtf8Error>
Returns the SpotifyId
as a base16 (hex) encoded, SpotifyId::SIZE_BASE16
(32)
character long String
.
sourcepub fn to_base62(&self) -> Result<String, FromUtf8Error>
pub fn to_base62(&self) -> Result<String, FromUtf8Error>
Returns the SpotifyId
as a canonically base62 encoded, SpotifyId::SIZE_BASE62
(22)
character long String
.
sourcepub fn to_raw(&self) -> [u8; 16]
pub fn to_raw(&self) -> [u8; 16]
Returns a copy of the SpotifyId
as an array of SpotifyId::SIZE
(16) bytes in
big-endian order.
sourcepub fn to_uri(&self) -> Result<String, FromUtf8Error>
pub fn to_uri(&self) -> Result<String, FromUtf8Error>
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 Copy for SpotifyId
impl Eq for SpotifyId
impl StructuralEq for SpotifyId
impl StructuralPartialEq for SpotifyId
Auto Trait Implementations
impl RefUnwindSafe for SpotifyId
impl Send for SpotifyId
impl Sync for SpotifyId
impl Unpin for SpotifyId
impl UnwindSafe for SpotifyId
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
sourceimpl<Q, K> Equivalent<K> for Q where
Q: Eq + ?Sized,
K: Borrow<Q> + ?Sized,
impl<Q, K> Equivalent<K> for Q where
Q: Eq + ?Sized,
K: Borrow<Q> + ?Sized,
sourcefn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Compare self to key
and return true
if they are equal.
sourceimpl<T> Instrument for T
impl<T> Instrument for T
sourcefn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
sourcefn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
impl<V, T> VZip<V> for T where
V: MultiLane<T>,
impl<V, T> VZip<V> for T where
V: MultiLane<T>,
fn vzip(self) -> V
sourceimpl<T> WithSubscriber for T
impl<T> WithSubscriber for T
sourcefn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self> where
S: Into<Dispatch>,
fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self> where
S: Into<Dispatch>,
Attaches the provided Subscriber
to this type, returning a
WithDispatch
wrapper. Read more
sourcefn with_current_subscriber(self) -> WithDispatch<Self>
fn with_current_subscriber(self) -> WithDispatch<Self>
Attaches the current default Subscriber
to this type, returning a
WithDispatch
wrapper. Read more