pub struct PlayerState {
pub position: usize,
pub player_position: Duration,
pub player_volume: PlayerVolume,
pub playback_state: PlaybackState,
pub tracks: Vec<Track>,
pub shuffled_tracks: Vec<Track>,
pub shuffle_state: ShuffleState,
pub loop_state: LoopState,
}Expand description
Data structure used to store playback state on the disc and in the RAM at runtime.
Fields§
§position: usizeThe index of the current track.
It can either point to the tracks variable or shuffled_tracks is shuffle is supported
and set to ShuffleState::On.
player_position: Duration§player_volume: PlayerVolume§playback_state: PlaybackState§tracks: Vec<Track>§shuffled_tracks: Vec<Track>§shuffle_state: ShuffleState§loop_state: LoopStateImplementations§
Source§impl PlayerState
impl PlayerState
pub fn set_tracks(&mut self, tracks: Vec<Track>)
pub fn append_tracks(&mut self, tracks: &mut Vec<Track>)
pub fn set_shuffle_state(&mut self, shuffle_state: ShuffleState)
pub fn increment_player_position(&mut self, duration: Duration)
pub fn set_player_position(&mut self, player_position: Duration)
pub fn set_player_volume(&mut self, player_volume: PlayerVolume)
pub fn set_loop_state(&mut self, loop_state: LoopState)
pub fn set_playback_state(&mut self, playback_state: PlaybackState)
pub fn is_empty(&self) -> bool
pub fn current(&self) -> Option<&Track>
pub fn play_track(&mut self, index: usize) -> Option<&Track>
pub fn can_seek(&self) -> bool
pub fn can_play(&self) -> bool
pub fn can_pause(&self) -> bool
pub fn can_go_next(&self) -> bool
pub fn next_track(&mut self) -> Option<&Track>
pub fn can_go_previous(&self) -> bool
pub fn previous_track(&mut self) -> Option<&Track>
Trait Implementations§
Source§impl Clone for PlayerState
impl Clone for PlayerState
Source§fn clone(&self) -> PlayerState
fn clone(&self) -> PlayerState
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · 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 PlayerState
impl Debug for PlayerState
Source§impl Default for PlayerState
impl Default for PlayerState
Source§fn default() -> PlayerState
fn default() -> PlayerState
Returns the “default value” for a type. Read more
Source§impl PartialEq for PlayerState
impl PartialEq for PlayerState
impl StructuralPartialEq for PlayerState
Auto Trait Implementations§
impl Freeze for PlayerState
impl RefUnwindSafe for PlayerState
impl Send for PlayerState
impl Sync for PlayerState
impl Unpin for PlayerState
impl UnsafeUnpin for PlayerState
impl UnwindSafe for PlayerState
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
impl<S, T> Duplex<S> for Twhere
T: FromSample<S> + ToSample<S>,
§impl<S> FromSample<S> for S
impl<S> FromSample<S> for S
fn from_sample_(s: S) -> S
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
§impl<F, T> IntoSample<T> for Fwhere
T: FromSample<F>,
impl<F, T> IntoSample<T> for Fwhere
T: FromSample<F>,
fn into_sample(self) -> T
§impl<T> NoneValue for Twhere
T: Default,
impl<T> NoneValue for Twhere
T: Default,
type NoneType = T
§fn null_value() -> T
fn null_value() -> T
The none-equivalent value.