pub struct PlaybackState {
pub device: Option<Device>,
pub repeat_state: Option<String>,
pub shuffle_state: Option<bool>,
pub context: Option<PlaybackContext>,
pub timestamp: Option<u64>,
pub progress_ms: Option<u64>,
pub is_playing: bool,
pub item: Option<Track>,
pub currently_playing_type: Option<String>,
pub actions: Option<PlaybackActions>,
}Expand description
Current playback state.
Fields§
§device: Option<Device>The device currently playing.
repeat_state: Option<String>Repeat mode: off, track, context.
shuffle_state: Option<bool>Whether shuffle is on.
context: Option<PlaybackContext>Playback context (album, playlist, etc.).
timestamp: Option<u64>Unix timestamp of when data was fetched.
progress_ms: Option<u64>Progress into the currently playing track (ms).
is_playing: boolWhether something is currently playing.
item: Option<Track>The currently playing track/episode.
currently_playing_type: Option<String>Currently playing type: track, episode, ad, unknown.
actions: Option<PlaybackActions>Actions available/restricted.
Implementations§
Source§impl PlaybackState
impl PlaybackState
Sourcepub fn track_name(&self) -> Option<&str>
pub fn track_name(&self) -> Option<&str>
Get the currently playing track name.
Sourcepub fn artist_name(&self) -> Option<&str>
pub fn artist_name(&self) -> Option<&str>
Get the currently playing artist name.
Sourcepub fn progress_str(&self) -> String
pub fn progress_str(&self) -> String
Get progress as MM:SS string.
Sourcepub fn duration_str(&self) -> String
pub fn duration_str(&self) -> String
Get duration as MM:SS string.
Sourcepub fn device_name(&self) -> Option<&str>
pub fn device_name(&self) -> Option<&str>
Get the device name.
Trait Implementations§
Source§impl Clone for PlaybackState
impl Clone for PlaybackState
Source§fn clone(&self) -> PlaybackState
fn clone(&self) -> PlaybackState
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for PlaybackState
impl Debug for PlaybackState
Source§impl<'de> Deserialize<'de> for PlaybackState
impl<'de> Deserialize<'de> for PlaybackState
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Auto Trait Implementations§
impl Freeze for PlaybackState
impl RefUnwindSafe for PlaybackState
impl Send for PlaybackState
impl Sync for PlaybackState
impl Unpin for PlaybackState
impl UnwindSafe for PlaybackState
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
Mutably borrows from an owned value. Read more